Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 5e007e2f84f08a4aa54351615c6025d826eb3f5b..cdecf985f7d6944c3ceb3c7d760853aad67ed69f 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -876,14 +876,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInPrototypeChain) { |
} |
-RUNTIME_FUNCTION(MaybeObject*, Runtime_IsConstructCall) { |
- NoHandleAllocation ha; |
- ASSERT(args.length() == 0); |
- JavaScriptFrameIterator it(isolate); |
- return isolate->heap()->ToBoolean(it.frame()->IsConstructor()); |
-} |
- |
- |
// Recursively traverses hidden prototypes if property is not found |
static void GetOwnPropertyImplementation(JSObject* obj, |
String* name, |
@@ -10715,6 +10707,7 @@ class FrameInspector { |
frame, inlined_jsframe_index, isolate); |
} |
has_adapted_arguments_ = frame_->has_adapted_arguments(); |
+ is_bottommost_ = inlined_jsframe_index == 0; |
is_optimized_ = frame_->is_optimized(); |
} |
@@ -10752,6 +10745,11 @@ class FrameInspector { |
? deoptimized_frame_->GetPc() |
: frame_->pc(); |
} |
+ bool IsConstructor() { |
+ return is_optimized_ && !is_bottommost_ |
+ ? deoptimized_frame_->HasConstructStub() |
+ : frame_->IsConstructor(); |
+ } |
// To inspect all the provided arguments the frame might need to be |
// replaced with the arguments frame. |
@@ -10767,6 +10765,7 @@ class FrameInspector { |
DeoptimizedFrameInfo* deoptimized_frame_; |
Isolate* isolate_; |
bool is_optimized_; |
+ bool is_bottommost_; |
bool has_adapted_arguments_; |
DISALLOW_COPY_AND_ASSIGN(FrameInspector); |
@@ -10796,6 +10795,16 @@ static SaveContext* FindSavedContextForFrame(Isolate* isolate, |
} |
+RUNTIME_FUNCTION(MaybeObject*, Runtime_IsConstructCall) { |
+ NoHandleAllocation ha; |
+ ASSERT(args.length() == 0); |
+ JavaScriptFrameIterator it(isolate); |
+ JavaScriptFrame* frame = it.frame(); |
+ FrameInspector frame_inspector(frame, frame->GetInlineCount() - 1, isolate); |
+ return isolate->heap()->ToBoolean(frame_inspector.IsConstructor()); |
+} |
+ |
+ |
// Return an array with frame details |
// args[0]: number: break id |
// args[1]: number: frame index |
@@ -10862,9 +10871,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameDetails) { |
Handle<SharedFunctionInfo> shared(function->shared()); |
int position = shared->code()->SourcePosition(frame_inspector.GetPc()); |
- // Check for constructor frame. Inlined frames cannot be construct calls. |
- bool inlined_frame = is_optimized && inlined_jsframe_index != 0; |
- bool constructor = !inlined_frame && it.frame()->IsConstructor(); |
+ // Check for constructor frame. |
+ bool constructor = frame_inspector.IsConstructor(); |
// Get scope info and read from it for local variable information. |
Handle<ScopeInfo> scope_info(shared->scope_info()); |