| 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(MessageTemplate::kStaticPrototype)); | 55 isolate, NewTypeError("static_prototype", HandleVector<Object>(NULL, 0))); |
| 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}; |
| 116 THROW_NEW_ERROR_RETURN_FAILURE( | 117 THROW_NEW_ERROR_RETURN_FAILURE( |
| 117 isolate, | 118 isolate, |
| 118 NewTypeError(MessageTemplate::kExtendsValueGenerator, super_class)); | 119 NewTypeError("extends_value_generator", HandleVector(args, 1))); |
| 119 } | 120 } |
| 120 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 121 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 121 isolate, prototype_parent, | 122 isolate, prototype_parent, |
| 122 Runtime::GetObjectProperty(isolate, super_class, | 123 Runtime::GetObjectProperty(isolate, super_class, |
| 123 isolate->factory()->prototype_string())); | 124 isolate->factory()->prototype_string())); |
| 124 if (!prototype_parent->IsNull() && !prototype_parent->IsSpecObject()) { | 125 if (!prototype_parent->IsNull() && !prototype_parent->IsSpecObject()) { |
| 126 Handle<Object> args[1] = {prototype_parent}; |
| 125 THROW_NEW_ERROR_RETURN_FAILURE( | 127 THROW_NEW_ERROR_RETURN_FAILURE( |
| 126 isolate, NewTypeError(MessageTemplate::kPrototypeParentNotAnObject, | 128 isolate, NewTypeError("prototype_parent_not_an_object", |
| 127 prototype_parent)); | 129 HandleVector(args, 1))); |
| 128 } | 130 } |
| 129 constructor_parent = super_class; | 131 constructor_parent = super_class; |
| 130 } else { | 132 } else { |
| 131 // TODO(arv): Should be IsConstructor. | 133 // TODO(arv): Should be IsConstructor. |
| 134 Handle<Object> args[1] = {super_class}; |
| 132 THROW_NEW_ERROR_RETURN_FAILURE( | 135 THROW_NEW_ERROR_RETURN_FAILURE( |
| 133 isolate, | 136 isolate, |
| 134 NewTypeError(MessageTemplate::kExtendsValueNotFunction, super_class)); | 137 NewTypeError("extends_value_not_a_function", HandleVector(args, 1))); |
| 135 } | 138 } |
| 136 } | 139 } |
| 137 | 140 |
| 138 Handle<Map> map = | 141 Handle<Map> map = |
| 139 isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 142 isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
| 140 Map::SetPrototype(map, prototype_parent); | 143 Map::SetPrototype(map, prototype_parent); |
| 141 map->SetConstructor(*constructor); | 144 map->SetConstructor(*constructor); |
| 142 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); | 145 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); |
| 143 | 146 |
| 144 Handle<String> name_string = name->IsString() | 147 Handle<String> name_string = name->IsString() |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 return nullptr; | 458 return nullptr; |
| 456 } | 459 } |
| 457 | 460 |
| 458 | 461 |
| 459 RUNTIME_FUNCTION(Runtime_CallSuperWithSpread) { | 462 RUNTIME_FUNCTION(Runtime_CallSuperWithSpread) { |
| 460 UNIMPLEMENTED(); | 463 UNIMPLEMENTED(); |
| 461 return nullptr; | 464 return nullptr; |
| 462 } | 465 } |
| 463 } | 466 } |
| 464 } // namespace v8::internal | 467 } // namespace v8::internal |
| OLD | NEW |