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 "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/accessors.h" | 10 #include "src/accessors.h" |
11 #include "src/arguments.h" | 11 #include "src/arguments.h" |
12 #include "src/debug/debug.h" | 12 #include "src/debug/debug.h" |
13 #include "src/elements.h" | 13 #include "src/elements.h" |
14 #include "src/frames-inl.h" | 14 #include "src/frames-inl.h" |
15 #include "src/isolate-inl.h" | 15 #include "src/isolate-inl.h" |
16 #include "src/messages.h" | 16 #include "src/messages.h" |
17 #include "src/runtime/runtime.h" | 17 #include "src/runtime/runtime.h" |
18 | 18 |
19 namespace v8 { | 19 namespace v8 { |
20 namespace internal { | 20 namespace internal { |
21 | 21 |
22 | 22 |
23 RUNTIME_FUNCTION(Runtime_ThrowNonMethodError) { | |
24 HandleScope scope(isolate); | |
25 DCHECK_EQ(0, args.length()); | |
26 THROW_NEW_ERROR_RETURN_FAILURE( | |
27 isolate, NewReferenceError(MessageTemplate::kNonMethod)); | |
28 } | |
29 | |
30 RUNTIME_FUNCTION(Runtime_ThrowUnsupportedSuperError) { | 23 RUNTIME_FUNCTION(Runtime_ThrowUnsupportedSuperError) { |
31 HandleScope scope(isolate); | 24 HandleScope scope(isolate); |
32 DCHECK_EQ(0, args.length()); | 25 DCHECK_EQ(0, args.length()); |
33 THROW_NEW_ERROR_RETURN_FAILURE( | 26 THROW_NEW_ERROR_RETURN_FAILURE( |
34 isolate, NewReferenceError(MessageTemplate::kUnsupportedSuper)); | 27 isolate, NewReferenceError(MessageTemplate::kUnsupportedSuper)); |
35 } | 28 } |
36 | 29 |
37 | 30 |
38 RUNTIME_FUNCTION(Runtime_ThrowConstructorNonCallableError) { | 31 RUNTIME_FUNCTION(Runtime_ThrowConstructorNonCallableError) { |
39 HandleScope scope(isolate); | 32 HandleScope scope(isolate); |
40 DCHECK_EQ(1, args.length()); | 33 DCHECK_EQ(1, args.length()); |
41 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0); | 34 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0); |
42 Handle<Object> name(constructor->shared()->name(), isolate); | 35 Handle<Object> name(constructor->shared()->name(), isolate); |
43 THROW_NEW_ERROR_RETURN_FAILURE( | 36 THROW_NEW_ERROR_RETURN_FAILURE( |
44 isolate, NewTypeError(MessageTemplate::kConstructorNonCallable, name)); | 37 isolate, NewTypeError(MessageTemplate::kConstructorNonCallable, name)); |
45 } | 38 } |
46 | 39 |
47 | 40 |
48 RUNTIME_FUNCTION(Runtime_ThrowArrayNotSubclassableError) { | |
49 HandleScope scope(isolate); | |
50 DCHECK_EQ(0, args.length()); | |
51 THROW_NEW_ERROR_RETURN_FAILURE( | |
52 isolate, NewTypeError(MessageTemplate::kArrayNotSubclassable)); | |
53 } | |
54 | |
55 RUNTIME_FUNCTION(Runtime_ThrowStaticPrototypeError) { | 41 RUNTIME_FUNCTION(Runtime_ThrowStaticPrototypeError) { |
56 HandleScope scope(isolate); | 42 HandleScope scope(isolate); |
57 DCHECK_EQ(0, args.length()); | 43 DCHECK_EQ(0, args.length()); |
58 THROW_NEW_ERROR_RETURN_FAILURE( | 44 THROW_NEW_ERROR_RETURN_FAILURE( |
59 isolate, NewTypeError(MessageTemplate::kStaticPrototype)); | 45 isolate, NewTypeError(MessageTemplate::kStaticPrototype)); |
60 } | 46 } |
61 | 47 |
62 namespace { | 48 namespace { |
63 | 49 |
64 Object* ThrowNotSuperConstructor(Isolate* isolate, Handle<Object> constructor, | 50 Object* ThrowNotSuperConstructor(Isolate* isolate, Handle<Object> constructor, |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 } | 490 } |
505 | 491 |
506 // Call the constructor. | 492 // Call the constructor. |
507 RETURN_RESULT_OR_FAILURE( | 493 RETURN_RESULT_OR_FAILURE( |
508 isolate, Execution::New(isolate, constructor, new_target, result_length, | 494 isolate, Execution::New(isolate, constructor, new_target, result_length, |
509 construct_args.start())); | 495 construct_args.start())); |
510 } | 496 } |
511 | 497 |
512 } // namespace internal | 498 } // namespace internal |
513 } // namespace v8 | 499 } // namespace v8 |
OLD | NEW |