| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 252 |
| 253 RUNTIME_FUNCTION(Runtime_PromiseRejectEvent) { | 253 RUNTIME_FUNCTION(Runtime_PromiseRejectEvent) { |
| 254 DCHECK(args.length() == 3); | 254 DCHECK(args.length() == 3); |
| 255 HandleScope scope(isolate); | 255 HandleScope scope(isolate); |
| 256 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); | 256 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |
| 257 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 257 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
| 258 CONVERT_BOOLEAN_ARG_CHECKED(debug_event, 2); | 258 CONVERT_BOOLEAN_ARG_CHECKED(debug_event, 2); |
| 259 if (debug_event) isolate->debug()->OnPromiseReject(promise, value); | 259 if (debug_event) isolate->debug()->OnPromiseReject(promise, value); |
| 260 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); | 260 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); |
| 261 // Do not report if we actually have a handler. | 261 // Do not report if we actually have a handler. |
| 262 if (JSReceiver::GetDataProperty(promise, key)->IsUndefined()) { | 262 if (JSReceiver::GetDataProperty(promise, key)->IsUndefined(isolate)) { |
| 263 isolate->ReportPromiseReject(promise, value, | 263 isolate->ReportPromiseReject(promise, value, |
| 264 v8::kPromiseRejectWithNoHandler); | 264 v8::kPromiseRejectWithNoHandler); |
| 265 } | 265 } |
| 266 return isolate->heap()->undefined_value(); | 266 return isolate->heap()->undefined_value(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 | 269 |
| 270 RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) { | 270 RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) { |
| 271 DCHECK(args.length() == 1); | 271 DCHECK(args.length() == 1); |
| 272 HandleScope scope(isolate); | 272 HandleScope scope(isolate); |
| 273 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); | 273 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |
| 274 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); | 274 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); |
| 275 // At this point, no revocation has been issued before | 275 // At this point, no revocation has been issued before |
| 276 RUNTIME_ASSERT(JSReceiver::GetDataProperty(promise, key)->IsUndefined()); | 276 RUNTIME_ASSERT( |
| 277 JSReceiver::GetDataProperty(promise, key)->IsUndefined(isolate)); |
| 277 isolate->ReportPromiseReject(promise, Handle<Object>(), | 278 isolate->ReportPromiseReject(promise, Handle<Object>(), |
| 278 v8::kPromiseHandlerAddedAfterReject); | 279 v8::kPromiseHandlerAddedAfterReject); |
| 279 return isolate->heap()->undefined_value(); | 280 return isolate->heap()->undefined_value(); |
| 280 } | 281 } |
| 281 | 282 |
| 282 | 283 |
| 283 RUNTIME_FUNCTION(Runtime_StackGuard) { | 284 RUNTIME_FUNCTION(Runtime_StackGuard) { |
| 284 SealHandleScope shs(isolate); | 285 SealHandleScope shs(isolate); |
| 285 DCHECK(args.length() == 0); | 286 DCHECK(args.length() == 0); |
| 286 | 287 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 445 |
| 445 namespace { | 446 namespace { |
| 446 | 447 |
| 447 bool ComputeLocation(Isolate* isolate, MessageLocation* target) { | 448 bool ComputeLocation(Isolate* isolate, MessageLocation* target) { |
| 448 JavaScriptFrameIterator it(isolate); | 449 JavaScriptFrameIterator it(isolate); |
| 449 if (!it.done()) { | 450 if (!it.done()) { |
| 450 JavaScriptFrame* frame = it.frame(); | 451 JavaScriptFrame* frame = it.frame(); |
| 451 JSFunction* fun = frame->function(); | 452 JSFunction* fun = frame->function(); |
| 452 Object* script = fun->shared()->script(); | 453 Object* script = fun->shared()->script(); |
| 453 if (script->IsScript() && | 454 if (script->IsScript() && |
| 454 !(Script::cast(script)->source()->IsUndefined())) { | 455 !(Script::cast(script)->source()->IsUndefined(isolate))) { |
| 455 Handle<Script> casted_script(Script::cast(script)); | 456 Handle<Script> casted_script(Script::cast(script), isolate); |
| 456 // Compute the location from the function and the relocation info of the | 457 // Compute the location from the function and the relocation info of the |
| 457 // baseline code. For optimized code this will use the deoptimization | 458 // baseline code. For optimized code this will use the deoptimization |
| 458 // information to get canonical location information. | 459 // information to get canonical location information. |
| 459 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); | 460 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
| 460 it.frame()->Summarize(&frames); | 461 it.frame()->Summarize(&frames); |
| 461 FrameSummary& summary = frames.last(); | 462 FrameSummary& summary = frames.last(); |
| 462 int pos = summary.abstract_code()->SourcePosition(summary.code_offset()); | 463 int pos = summary.abstract_code()->SourcePosition(summary.code_offset()); |
| 463 *target = MessageLocation(casted_script, pos, pos + 1, handle(fun)); | 464 *target = MessageLocation(casted_script, pos, pos + 1, handle(fun)); |
| 464 return true; | 465 return true; |
| 465 } | 466 } |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 HandleScope scope(isolate); | 620 HandleScope scope(isolate); |
| 620 DCHECK_EQ(1, args.length()); | 621 DCHECK_EQ(1, args.length()); |
| 621 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 622 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
| 622 bool is_wasm_object = object->IsJSObject() && | 623 bool is_wasm_object = object->IsJSObject() && |
| 623 wasm::IsWasmObject(Handle<JSObject>::cast(object)); | 624 wasm::IsWasmObject(Handle<JSObject>::cast(object)); |
| 624 return *isolate->factory()->ToBoolean(is_wasm_object); | 625 return *isolate->factory()->ToBoolean(is_wasm_object); |
| 625 } | 626 } |
| 626 | 627 |
| 627 } // namespace internal | 628 } // namespace internal |
| 628 } // namespace v8 | 629 } // namespace v8 |
| OLD | NEW |