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

Unified Diff: src/runtime/runtime-classes.cc

Issue 1448933002: Introduce a BuiltinsConstructStub that sets up new.target and does a [[call]] per ES6 9.3.2 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/runtime/runtime.h ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-classes.cc
diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc
index dbddbefbae927a30708bca7217cc6cab06057cd6..8ddd20db3dab6403c5c08da4d646ad3b31ee0268 100644
--- a/src/runtime/runtime-classes.cc
+++ b/src/runtime/runtime-classes.cc
@@ -142,7 +142,11 @@ static MaybeHandle<Object> DefineClass(Isolate* isolate, Handle<Object> name,
constructor->shared()->set_name(*name_string);
if (!super_class->IsTheHole()) {
- Handle<Code> stub(isolate->builtins()->JSConstructStubForDerived());
+ // Derived classes, just like builtins, don't create implicit receivers in
+ // [[construct]]. Instead they just set up new.target and call into the
+ // constructor. Hence we can reuse the builtins construct stub for derived
+ // classes.
+ Handle<Code> stub(isolate->builtins()->JSBuiltinsConstructStub());
constructor->shared()->set_construct_stub(*stub);
}
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698