OLD | NEW |
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/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 RUNTIME_FUNCTION(Runtime_ThrowArrayNotSubclassableError) { | 45 RUNTIME_FUNCTION(Runtime_ThrowArrayNotSubclassableError) { |
46 HandleScope scope(isolate); | 46 HandleScope scope(isolate); |
47 DCHECK(args.length() == 0); | 47 DCHECK(args.length() == 0); |
48 THROW_NEW_ERROR_RETURN_FAILURE( | 48 THROW_NEW_ERROR_RETURN_FAILURE( |
49 isolate, NewTypeError(MessageTemplate::kArrayNotSubclassable)); | 49 isolate, NewTypeError(MessageTemplate::kArrayNotSubclassable)); |
50 } | 50 } |
51 | 51 |
52 | 52 |
53 static Object* ThrowStaticPrototypeError(Isolate* isolate) { | 53 static Object* ThrowStaticPrototypeError(Isolate* isolate) { |
54 THROW_NEW_ERROR_RETURN_FAILURE( | 54 THROW_NEW_ERROR_RETURN_FAILURE( |
55 isolate, NewTypeError("static_prototype", HandleVector<Object>(NULL, 0))); | 55 isolate, NewTypeError(MessageTemplate::kStaticPrototype)); |
56 } | 56 } |
57 | 57 |
58 | 58 |
59 RUNTIME_FUNCTION(Runtime_ThrowStaticPrototypeError) { | 59 RUNTIME_FUNCTION(Runtime_ThrowStaticPrototypeError) { |
60 HandleScope scope(isolate); | 60 HandleScope scope(isolate); |
61 DCHECK(args.length() == 0); | 61 DCHECK(args.length() == 0); |
62 return ThrowStaticPrototypeError(isolate); | 62 return ThrowStaticPrototypeError(isolate); |
63 } | 63 } |
64 | 64 |
65 | 65 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 Handle<Object> prototype_parent; | 106 Handle<Object> prototype_parent; |
107 Handle<Object> constructor_parent; | 107 Handle<Object> constructor_parent; |
108 | 108 |
109 if (super_class->IsTheHole()) { | 109 if (super_class->IsTheHole()) { |
110 prototype_parent = isolate->initial_object_prototype(); | 110 prototype_parent = isolate->initial_object_prototype(); |
111 } else { | 111 } else { |
112 if (super_class->IsNull()) { | 112 if (super_class->IsNull()) { |
113 prototype_parent = isolate->factory()->null_value(); | 113 prototype_parent = isolate->factory()->null_value(); |
114 } else if (super_class->IsSpecFunction()) { | 114 } else if (super_class->IsSpecFunction()) { |
115 if (Handle<JSFunction>::cast(super_class)->shared()->is_generator()) { | 115 if (Handle<JSFunction>::cast(super_class)->shared()->is_generator()) { |
116 Handle<Object> args[1] = {super_class}; | |
117 THROW_NEW_ERROR_RETURN_FAILURE( | 116 THROW_NEW_ERROR_RETURN_FAILURE( |
118 isolate, | 117 isolate, |
119 NewTypeError("extends_value_generator", HandleVector(args, 1))); | 118 NewTypeError(MessageTemplate::kExtendsValueGenerator, super_class)); |
120 } | 119 } |
121 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 120 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
122 isolate, prototype_parent, | 121 isolate, prototype_parent, |
123 Runtime::GetObjectProperty(isolate, super_class, | 122 Runtime::GetObjectProperty(isolate, super_class, |
124 isolate->factory()->prototype_string())); | 123 isolate->factory()->prototype_string())); |
125 if (!prototype_parent->IsNull() && !prototype_parent->IsSpecObject()) { | 124 if (!prototype_parent->IsNull() && !prototype_parent->IsSpecObject()) { |
126 Handle<Object> args[1] = {prototype_parent}; | |
127 THROW_NEW_ERROR_RETURN_FAILURE( | 125 THROW_NEW_ERROR_RETURN_FAILURE( |
128 isolate, NewTypeError("prototype_parent_not_an_object", | 126 isolate, NewTypeError(MessageTemplate::kPrototypeParentNotAnObject, |
129 HandleVector(args, 1))); | 127 prototype_parent)); |
130 } | 128 } |
131 constructor_parent = super_class; | 129 constructor_parent = super_class; |
132 } else { | 130 } else { |
133 // TODO(arv): Should be IsConstructor. | 131 // TODO(arv): Should be IsConstructor. |
134 Handle<Object> args[1] = {super_class}; | |
135 THROW_NEW_ERROR_RETURN_FAILURE( | 132 THROW_NEW_ERROR_RETURN_FAILURE( |
136 isolate, | 133 isolate, |
137 NewTypeError("extends_value_not_a_function", HandleVector(args, 1))); | 134 NewTypeError(MessageTemplate::kExtendsValueNotFunction, super_class)); |
138 } | 135 } |
139 } | 136 } |
140 | 137 |
141 Handle<Map> map = | 138 Handle<Map> map = |
142 isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 139 isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
143 Map::SetPrototype(map, prototype_parent); | 140 Map::SetPrototype(map, prototype_parent); |
144 map->SetConstructor(*constructor); | 141 map->SetConstructor(*constructor); |
145 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); | 142 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); |
146 | 143 |
147 Handle<String> name_string = name->IsString() | 144 Handle<String> name_string = name->IsString() |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 return nullptr; | 455 return nullptr; |
459 } | 456 } |
460 | 457 |
461 | 458 |
462 RUNTIME_FUNCTION(Runtime_CallSuperWithSpread) { | 459 RUNTIME_FUNCTION(Runtime_CallSuperWithSpread) { |
463 UNIMPLEMENTED(); | 460 UNIMPLEMENTED(); |
464 return nullptr; | 461 return nullptr; |
465 } | 462 } |
466 } | 463 } |
467 } // namespace v8::internal | 464 } // namespace v8::internal |
OLD | NEW |