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

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

Issue 1347243004: [strong] Implement revised strong class semantics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: \cl feedback Created 5 years, 3 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.cc ('k') | test/mjsunit/strong/class-literals.js » ('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 "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 135
136 Handle<Map> map = 136 Handle<Map> map =
137 isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 137 isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
138 if (constructor->map()->is_strong()) { 138 if (constructor->map()->is_strong()) {
139 map->set_is_strong(); 139 map->set_is_strong();
140 if (super_class->IsNull()) { 140 if (super_class->IsNull()) {
141 // Strong class is not permitted to extend null. 141 // Strong class is not permitted to extend null.
142 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kStrongExtendNull), 142 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kStrongExtendNull),
143 Object); 143 Object);
144 } 144 }
145 } else {
146 if (Handle<HeapObject>::cast(super_class)->map()->is_strong()) {
147 // Weak class is not permitted to extend strong class.
148 THROW_NEW_ERROR(isolate,
149 NewTypeError(MessageTemplate::kStrongWeakExtend, name),
150 Object);
151 }
152 } 145 }
153 Map::SetPrototype(map, prototype_parent); 146 Map::SetPrototype(map, prototype_parent);
154 map->SetConstructor(*constructor); 147 map->SetConstructor(*constructor);
155 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); 148 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map);
156 149
157 Handle<String> name_string = name->IsString() 150 Handle<String> name_string = name->IsString()
158 ? Handle<String>::cast(name) 151 ? Handle<String>::cast(name)
159 : isolate->factory()->empty_string(); 152 : isolate->factory()->empty_string();
160 constructor->shared()->set_name(*name_string); 153 constructor->shared()->set_name(*name_string);
161 154
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 Handle<Object> result; 533 Handle<Object> result;
541 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 534 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
542 isolate, result, 535 isolate, result,
543 Execution::Call(isolate, reflect, isolate->factory()->undefined_value(), 536 Execution::Call(isolate, reflect, isolate->factory()->undefined_value(),
544 arraysize(argv), argv)); 537 arraysize(argv), argv));
545 538
546 return *result; 539 return *result;
547 } 540 }
548 } // namespace internal 541 } // namespace internal
549 } // namespace v8 542 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/strong/class-literals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698