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 "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/ast/prettyprinter.h" | 8 #include "src/ast/prettyprinter.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 RUNTIME_FUNCTION(Runtime_ReThrow) { | 86 RUNTIME_FUNCTION(Runtime_ReThrow) { |
87 HandleScope scope(isolate); | 87 HandleScope scope(isolate); |
88 DCHECK(args.length() == 1); | 88 DCHECK(args.length() == 1); |
89 return isolate->ReThrow(args[0]); | 89 return isolate->ReThrow(args[0]); |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 RUNTIME_FUNCTION(Runtime_ThrowStackOverflow) { | 93 RUNTIME_FUNCTION(Runtime_ThrowStackOverflow) { |
94 SealHandleScope shs(isolate); | 94 SealHandleScope shs(isolate); |
95 DCHECK_LE(0, args.length()); | 95 DCHECK_EQ(0, args.length()); |
96 return isolate->StackOverflow(); | 96 return isolate->StackOverflow(); |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 RUNTIME_FUNCTION(Runtime_UnwindAndFindExceptionHandler) { | 100 RUNTIME_FUNCTION(Runtime_UnwindAndFindExceptionHandler) { |
101 SealHandleScope shs(isolate); | 101 SealHandleScope shs(isolate); |
102 DCHECK(args.length() == 0); | 102 DCHECK(args.length() == 0); |
103 return isolate->UnwindAndFindHandler(); | 103 return isolate->UnwindAndFindHandler(); |
104 } | 104 } |
105 | 105 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 | 173 |
174 RUNTIME_FUNCTION(Runtime_ThrowStrongModeImplicitConversion) { | 174 RUNTIME_FUNCTION(Runtime_ThrowStrongModeImplicitConversion) { |
175 HandleScope scope(isolate); | 175 HandleScope scope(isolate); |
176 DCHECK(args.length() == 0); | 176 DCHECK(args.length() == 0); |
177 THROW_NEW_ERROR_RETURN_FAILURE( | 177 THROW_NEW_ERROR_RETURN_FAILURE( |
178 isolate, NewTypeError(MessageTemplate::kStrongImplicitConversion)); | 178 isolate, NewTypeError(MessageTemplate::kStrongImplicitConversion)); |
179 } | 179 } |
180 | 180 |
181 | 181 |
182 RUNTIME_FUNCTION(Runtime_ThrowApplyNonFunction) { | |
183 HandleScope scope(isolate); | |
184 DCHECK_EQ(1, args.length()); | |
185 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | |
186 Handle<String> type = Object::TypeOf(isolate, object); | |
187 THROW_NEW_ERROR_RETURN_FAILURE( | |
188 isolate, NewTypeError(MessageTemplate::kApplyNonFunction, object, type)); | |
189 } | |
190 | |
191 | |
192 RUNTIME_FUNCTION(Runtime_PromiseRejectEvent) { | 182 RUNTIME_FUNCTION(Runtime_PromiseRejectEvent) { |
193 DCHECK(args.length() == 3); | 183 DCHECK(args.length() == 3); |
194 HandleScope scope(isolate); | 184 HandleScope scope(isolate); |
195 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); | 185 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |
196 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 186 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
197 CONVERT_BOOLEAN_ARG_CHECKED(debug_event, 2); | 187 CONVERT_BOOLEAN_ARG_CHECKED(debug_event, 2); |
198 if (debug_event) isolate->debug()->OnPromiseReject(promise, value); | 188 if (debug_event) isolate->debug()->OnPromiseReject(promise, value); |
199 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); | 189 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); |
200 // Do not report if we actually have a handler. | 190 // Do not report if we actually have a handler. |
201 if (JSReceiver::GetDataProperty(promise, key)->IsUndefined()) { | 191 if (JSReceiver::GetDataProperty(promise, key)->IsUndefined()) { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 430 |
441 RUNTIME_FUNCTION(Runtime_ThrowConstructedNonConstructable) { | 431 RUNTIME_FUNCTION(Runtime_ThrowConstructedNonConstructable) { |
442 HandleScope scope(isolate); | 432 HandleScope scope(isolate); |
443 DCHECK_EQ(1, args.length()); | 433 DCHECK_EQ(1, args.length()); |
444 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 434 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
445 Handle<String> callsite = RenderCallSite(isolate, object); | 435 Handle<String> callsite = RenderCallSite(isolate, object); |
446 THROW_NEW_ERROR_RETURN_FAILURE( | 436 THROW_NEW_ERROR_RETURN_FAILURE( |
447 isolate, NewTypeError(MessageTemplate::kNotConstructor, callsite)); | 437 isolate, NewTypeError(MessageTemplate::kNotConstructor, callsite)); |
448 } | 438 } |
449 | 439 |
450 | |
451 // ES6 section 7.3.17 CreateListFromArrayLike (obj) | |
452 RUNTIME_FUNCTION(Runtime_CreateListFromArrayLike) { | |
453 HandleScope scope(isolate); | |
454 DCHECK_EQ(1, args.length()); | |
455 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | |
456 Handle<FixedArray> result; | |
457 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | |
458 isolate, result, | |
459 Object::CreateListFromArrayLike(isolate, object, ElementTypes::kAll)); | |
460 return *result; | |
461 } | |
462 | |
463 } // namespace internal | 440 } // namespace internal |
464 } // namespace v8 | 441 } // namespace v8 |
OLD | NEW |