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_EQ(0, args.length()); | 95 DCHECK_LE(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 |
182 RUNTIME_FUNCTION(Runtime_PromiseRejectEvent) { | 192 RUNTIME_FUNCTION(Runtime_PromiseRejectEvent) { |
183 DCHECK(args.length() == 3); | 193 DCHECK(args.length() == 3); |
184 HandleScope scope(isolate); | 194 HandleScope scope(isolate); |
185 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); | 195 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |
186 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 196 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
187 CONVERT_BOOLEAN_ARG_CHECKED(debug_event, 2); | 197 CONVERT_BOOLEAN_ARG_CHECKED(debug_event, 2); |
188 if (debug_event) isolate->debug()->OnPromiseReject(promise, value); | 198 if (debug_event) isolate->debug()->OnPromiseReject(promise, value); |
189 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); | 199 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); |
190 // Do not report if we actually have a handler. | 200 // Do not report if we actually have a handler. |
191 if (JSReceiver::GetDataProperty(promise, key)->IsUndefined()) { | 201 if (JSReceiver::GetDataProperty(promise, key)->IsUndefined()) { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 | 440 |
431 RUNTIME_FUNCTION(Runtime_ThrowConstructedNonConstructable) { | 441 RUNTIME_FUNCTION(Runtime_ThrowConstructedNonConstructable) { |
432 HandleScope scope(isolate); | 442 HandleScope scope(isolate); |
433 DCHECK_EQ(1, args.length()); | 443 DCHECK_EQ(1, args.length()); |
434 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 444 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
435 Handle<String> callsite = RenderCallSite(isolate, object); | 445 Handle<String> callsite = RenderCallSite(isolate, object); |
436 THROW_NEW_ERROR_RETURN_FAILURE( | 446 THROW_NEW_ERROR_RETURN_FAILURE( |
437 isolate, NewTypeError(MessageTemplate::kNotConstructor, callsite)); | 447 isolate, NewTypeError(MessageTemplate::kNotConstructor, callsite)); |
438 } | 448 } |
439 | 449 |
| 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 |
440 } // namespace internal | 463 } // namespace internal |
441 } // namespace v8 | 464 } // namespace v8 |
OLD | NEW |