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

Side by Side Diff: src/runtime/runtime-classes.cc

Issue 908883002: new classes: implement new.target passing to superclass constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix x64 arithmetic Created 5 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 unified diff | Download patch
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime-function.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 map->SetPrototype(prototype_parent); 110 map->SetPrototype(prototype_parent);
111 map->set_constructor(*constructor); 111 map->set_constructor(*constructor);
112 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); 112 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map);
113 113
114 Handle<String> name_string = name->IsString() 114 Handle<String> name_string = name->IsString()
115 ? Handle<String>::cast(name) 115 ? Handle<String>::cast(name)
116 : isolate->factory()->empty_string(); 116 : isolate->factory()->empty_string();
117 constructor->shared()->set_name(*name_string); 117 constructor->shared()->set_name(*name_string);
118 118
119 if (FLAG_experimental_classes) { 119 if (FLAG_experimental_classes) {
120 if (!super_class->IsTheHole() && !super_class->IsNull()) { 120 if (!super_class->IsTheHole()) {
121 Handle<Code> stub(isolate->builtins()->JSConstructStubForDerived()); 121 Handle<Code> stub(isolate->builtins()->JSConstructStubForDerived());
122 constructor->shared()->set_construct_stub(*stub); 122 constructor->shared()->set_construct_stub(*stub);
123 } 123 }
124 } 124 }
125 125
126 JSFunction::SetPrototype(constructor, prototype); 126 JSFunction::SetPrototype(constructor, prototype);
127 PropertyAttributes attribs = 127 PropertyAttributes attribs =
128 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 128 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
129 RETURN_FAILURE_ON_EXCEPTION( 129 RETURN_FAILURE_ON_EXCEPTION(
130 isolate, JSObject::SetOwnPropertyIgnoreAttributes( 130 isolate, JSObject::SetOwnPropertyIgnoreAttributes(
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 } 454 }
455 455
456 Handle<Object> result; 456 Handle<Object> result;
457 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 457 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
458 isolate, result, 458 isolate, result,
459 Execution::Call(isolate, proto_function, receiver, argc, argv, false)); 459 Execution::Call(isolate, proto_function, receiver, argc, argv, false));
460 return *result; 460 return *result;
461 } 461 }
462 } 462 }
463 } // namespace v8::internal 463 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime-function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698