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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <limits> 8 #include <limits>
9 9
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 Map::SetPrototype(map, prototype_parent); 135 Map::SetPrototype(map, prototype_parent);
136 map->SetConstructor(*constructor); 136 map->SetConstructor(*constructor);
137 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); 137 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map);
138 138
139 Handle<String> name_string = name->IsString() 139 Handle<String> name_string = name->IsString()
140 ? Handle<String>::cast(name) 140 ? Handle<String>::cast(name)
141 : isolate->factory()->empty_string(); 141 : isolate->factory()->empty_string();
142 constructor->shared()->set_name(*name_string); 142 constructor->shared()->set_name(*name_string);
143 143
144 if (!super_class->IsTheHole()) { 144 if (!super_class->IsTheHole()) {
145 Handle<Code> stub(isolate->builtins()->JSConstructStubForDerived()); 145 Handle<Code> stub(isolate->builtins()->JSBuiltinsConstructStub());
Igor Sheludko 2015/11/18 09:16:07 Please add a comment about why do we use JSBuiltin
Toon Verwaest 2015/11/18 13:24:57 Done.
146 constructor->shared()->set_construct_stub(*stub); 146 constructor->shared()->set_construct_stub(*stub);
147 } 147 }
148 148
149 JSFunction::SetPrototype(constructor, prototype); 149 JSFunction::SetPrototype(constructor, prototype);
150 PropertyAttributes attribs = 150 PropertyAttributes attribs =
151 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 151 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
152 RETURN_ON_EXCEPTION(isolate, 152 RETURN_ON_EXCEPTION(isolate,
153 JSObject::SetOwnPropertyIgnoreAttributes( 153 JSObject::SetOwnPropertyIgnoreAttributes(
154 constructor, isolate->factory()->prototype_string(), 154 constructor, isolate->factory()->prototype_string(),
155 prototype, attribs), 155 prototype, attribs),
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 Handle<Object> result; 497 Handle<Object> result;
498 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 498 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
499 isolate, result, Execution::New(isolate, super_constructor, new_target, 499 isolate, result, Execution::New(isolate, super_constructor, new_target,
500 argument_count, arguments.get())); 500 argument_count, arguments.get()));
501 501
502 return *result; 502 return *result;
503 } 503 }
504 504
505 } // namespace internal 505 } // namespace internal
506 } // namespace v8 506 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-object.cc » ('j') | src/x64/builtins-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698