Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(974)

Unified Diff: src/runtime.cc

Issue 9304001: Implement inlining of constructor calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed moar comments by Vyacheslav Egorov. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | src/type-info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « src/objects.cc ('k') | src/type-info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698