Reviewers: Jakob,
Description:
Reduce SharedFunctionInfo size.
The API function data and the debug info fields are never used at the same
time, as API functions are not debuggable. We can share a field.
[email protected]
Please review this at https://codereview.chromium.org/1252473002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+7, -3 lines):
M src/factory.cc
M src/objects.h
M src/objects-inl.h
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index
77c84505d8c7411befd94771244caf394bc36706..50aa848070caa77d07ea23c9fd2d73d1b66bcd61
100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -2269,6 +2269,8 @@ Handle<String> Factory::NumberToString(Handle<Object>
number,
Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared)
{
+ // API functions cannot be debugged and cannot have a debug info.
+ DCHECK(!shared->IsApiFunction());
// Allocate initial fixed array for active break points before
allocating the
// debug info object to avoid allocation while setting up the debug info
// object.
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index
a4ca8c34e29eeec8737c7f0b3025952c319b54cd..1f73c74aebea09e4fadfbae211e95941039adf90
100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -5476,7 +5476,7 @@ bool SharedFunctionInfo::is_simple_parameter_list() {
bool SharedFunctionInfo::HasDebugInfo() {
- bool has_debug_info = debug_info()->IsStruct();
+ bool has_debug_info = !IsApiFunction() && debug_info()->IsStruct();
DCHECK(!has_debug_info || HasDebugCode());
return has_debug_info;
}
@@ -5590,6 +5590,7 @@ void SharedFunctionInfo::TryReenableOptimization() {
bool SharedFunctionInfo::IsSubjectToDebugging() {
+ if (IsApiFunction()) return false;
Object* script_obj = script();
if (script_obj->IsUndefined()) return false;
Script* script = Script::cast(script_obj);
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
d8852427613ce939b7542b209bb5f39b0a522d63..80b8860e41fb9e1c4c5110a795d84eed403d254d
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -6911,11 +6911,12 @@ class SharedFunctionInfo: public HeapObject {
static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize;
static const int kInstanceClassNameOffset =
kConstructStubOffset + kPointerSize;
+ // Shared field: a function is either an API function or debuggable.
static const int kFunctionDataOffset =
kInstanceClassNameOffset + kPointerSize;
+ static const int kDebugInfoOffset = kFunctionDataOffset;
static const int kScriptOffset = kFunctionDataOffset + kPointerSize;
- static const int kDebugInfoOffset = kScriptOffset + kPointerSize;
- static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize;
+ static const int kInferredNameOffset = kScriptOffset + kPointerSize;
static const int kFeedbackVectorOffset =
kInferredNameOffset + kPointerSize;
#if TRACE_MAPS
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.