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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/debug.h" | 9 #include "src/debug.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 RUNTIME_FUNCTION(Runtime_ThrowReferenceError) { | 54 RUNTIME_FUNCTION(Runtime_ThrowReferenceError) { |
55 HandleScope scope(isolate); | 55 HandleScope scope(isolate); |
56 DCHECK(args.length() == 1); | 56 DCHECK(args.length() == 1); |
57 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); | 57 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); |
58 THROW_NEW_ERROR_RETURN_FAILURE( | 58 THROW_NEW_ERROR_RETURN_FAILURE( |
59 isolate, NewReferenceError(MessageTemplate::kNotDefined, name)); | 59 isolate, NewReferenceError(MessageTemplate::kNotDefined, name)); |
60 } | 60 } |
61 | 61 |
62 | 62 |
| 63 RUNTIME_FUNCTION(Runtime_NewTypeError) { |
| 64 HandleScope scope(isolate); |
| 65 DCHECK(args.length() == 2); |
| 66 CONVERT_INT32_ARG_CHECKED(template_index, 0); |
| 67 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 1); |
| 68 auto message_template = |
| 69 static_cast<MessageTemplate::Template>(template_index); |
| 70 return *isolate->factory()->NewTypeError(message_template, arg0); |
| 71 } |
| 72 |
| 73 |
| 74 RUNTIME_FUNCTION(Runtime_NewReferenceError) { |
| 75 HandleScope scope(isolate); |
| 76 DCHECK(args.length() == 2); |
| 77 CONVERT_INT32_ARG_CHECKED(template_index, 0); |
| 78 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 1); |
| 79 auto message_template = |
| 80 static_cast<MessageTemplate::Template>(template_index); |
| 81 return *isolate->factory()->NewReferenceError(message_template, arg0); |
| 82 } |
| 83 |
| 84 |
| 85 RUNTIME_FUNCTION(Runtime_NewSyntaxError) { |
| 86 HandleScope scope(isolate); |
| 87 DCHECK(args.length() == 2); |
| 88 CONVERT_INT32_ARG_CHECKED(template_index, 0); |
| 89 CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 1); |
| 90 auto message_template = |
| 91 static_cast<MessageTemplate::Template>(template_index); |
| 92 return *isolate->factory()->NewSyntaxError(message_template, arg0); |
| 93 } |
| 94 |
| 95 |
63 RUNTIME_FUNCTION(Runtime_ThrowIteratorResultNotAnObject) { | 96 RUNTIME_FUNCTION(Runtime_ThrowIteratorResultNotAnObject) { |
64 HandleScope scope(isolate); | 97 HandleScope scope(isolate); |
65 DCHECK(args.length() == 1); | 98 DCHECK(args.length() == 1); |
66 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); | 99 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); |
67 THROW_NEW_ERROR_RETURN_FAILURE( | 100 THROW_NEW_ERROR_RETURN_FAILURE( |
68 isolate, | 101 isolate, |
69 NewTypeError(MessageTemplate::kIteratorResultNotAnObject, value)); | 102 NewTypeError(MessageTemplate::kIteratorResultNotAnObject, value)); |
70 } | 103 } |
71 | 104 |
72 | 105 |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 RUNTIME_FUNCTION(Runtime_GetCallerJSFunction) { | 454 RUNTIME_FUNCTION(Runtime_GetCallerJSFunction) { |
422 SealHandleScope shs(isolate); | 455 SealHandleScope shs(isolate); |
423 StackFrameIterator it(isolate); | 456 StackFrameIterator it(isolate); |
424 RUNTIME_ASSERT(it.frame()->type() == StackFrame::STUB); | 457 RUNTIME_ASSERT(it.frame()->type() == StackFrame::STUB); |
425 it.Advance(); | 458 it.Advance(); |
426 RUNTIME_ASSERT(it.frame()->type() == StackFrame::JAVA_SCRIPT); | 459 RUNTIME_ASSERT(it.frame()->type() == StackFrame::JAVA_SCRIPT); |
427 return JavaScriptFrame::cast(it.frame())->function(); | 460 return JavaScriptFrame::cast(it.frame())->function(); |
428 } | 461 } |
429 } // namespace internal | 462 } // namespace internal |
430 } // namespace v8 | 463 } // namespace v8 |
OLD | NEW |