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

Unified Diff: src/objects.cc

Issue 1590273002: [runtime] No need to carry around the creation context for JSBoundFunctions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix debug. Created 4 years, 11 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.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 7984a86307b58f7c80b17c38fd0947d3285637fc..a9161e5f9184cc3ada969f6f28864db116d1727a 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2571,18 +2571,19 @@ Handle<String> JSReceiver::GetConstructorName(Handle<JSReceiver> receiver) {
Context* JSReceiver::GetCreationContext() {
- if (IsJSBoundFunction()) {
- return JSBoundFunction::cast(this)->creation_context();
+ JSReceiver* receiver = this;
+ while (receiver->IsJSBoundFunction()) {
+ receiver = JSBoundFunction::cast(receiver)->bound_target_function();
}
- Object* constructor = map()->GetConstructor();
+ Object* constructor = receiver->map()->GetConstructor();
JSFunction* function;
if (constructor->IsJSFunction()) {
function = JSFunction::cast(constructor);
} else {
// Functions have null as a constructor,
// but any JSFunction knows its context immediately.
- CHECK(IsJSFunction());
- function = JSFunction::cast(this);
+ CHECK(receiver->IsJSFunction());
+ function = JSFunction::cast(receiver);
}
return function->context()->native_context();
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698