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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 RUNTIME_FUNCTION(Runtime_AllocateSeqTwoByteString) { | 358 RUNTIME_FUNCTION(Runtime_AllocateSeqTwoByteString) { |
359 HandleScope scope(isolate); | 359 HandleScope scope(isolate); |
360 DCHECK_EQ(1, args.length()); | 360 DCHECK_EQ(1, args.length()); |
361 CONVERT_SMI_ARG_CHECKED(length, 0); | 361 CONVERT_SMI_ARG_CHECKED(length, 0); |
362 Handle<SeqTwoByteString> result; | 362 Handle<SeqTwoByteString> result; |
363 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 363 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
364 isolate, result, isolate->factory()->NewRawTwoByteString(length)); | 364 isolate, result, isolate->factory()->NewRawTwoByteString(length)); |
365 return *result; | 365 return *result; |
366 } | 366 } |
367 | 367 |
| 368 // Collect the raw data for a stack trace. Returns an array of 4 |
| 369 // element segments each containing a receiver, function, code and |
| 370 // native code offset. |
| 371 RUNTIME_FUNCTION(Runtime_CollectStackTrace) { |
| 372 HandleScope scope(isolate); |
| 373 DCHECK(args.length() == 2); |
| 374 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, error_object, 0); |
| 375 CONVERT_ARG_HANDLE_CHECKED(Object, caller, 1); |
368 | 376 |
| 377 if (!isolate->bootstrapper()->IsActive()) { |
| 378 // Optionally capture a more detailed stack trace for the message. |
| 379 RETURN_FAILURE_ON_EXCEPTION( |
| 380 isolate, isolate->CaptureAndSetDetailedStackTrace(error_object)); |
| 381 // Capture a simple stack trace for the stack property. |
| 382 RETURN_FAILURE_ON_EXCEPTION( |
| 383 isolate, isolate->CaptureAndSetSimpleStackTrace(error_object, caller)); |
| 384 } |
| 385 return isolate->heap()->undefined_value(); |
| 386 } |
| 387 |
| 388 |
369 RUNTIME_FUNCTION(Runtime_MessageGetStartPosition) { | 389 RUNTIME_FUNCTION(Runtime_MessageGetStartPosition) { |
370 SealHandleScope shs(isolate); | 390 SealHandleScope shs(isolate); |
371 DCHECK(args.length() == 1); | 391 DCHECK(args.length() == 1); |
372 CONVERT_ARG_CHECKED(JSMessageObject, message, 0); | 392 CONVERT_ARG_CHECKED(JSMessageObject, message, 0); |
373 return Smi::FromInt(message->start_position()); | 393 return Smi::FromInt(message->start_position()); |
374 } | 394 } |
375 | 395 |
376 | 396 |
377 RUNTIME_FUNCTION(Runtime_MessageGetScript) { | 397 RUNTIME_FUNCTION(Runtime_MessageGetScript) { |
378 SealHandleScope shs(isolate); | 398 SealHandleScope shs(isolate); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 HandleScope scope(isolate); | 639 HandleScope scope(isolate); |
620 DCHECK_EQ(1, args.length()); | 640 DCHECK_EQ(1, args.length()); |
621 CONVERT_ARG_CHECKED(Object, object, 0); | 641 CONVERT_ARG_CHECKED(Object, object, 0); |
622 bool is_wasm_object = | 642 bool is_wasm_object = |
623 object->IsJSObject() && wasm::IsWasmObject(JSObject::cast(object)); | 643 object->IsJSObject() && wasm::IsWasmObject(JSObject::cast(object)); |
624 return *isolate->factory()->ToBoolean(is_wasm_object); | 644 return *isolate->factory()->ToBoolean(is_wasm_object); |
625 } | 645 } |
626 | 646 |
627 } // namespace internal | 647 } // namespace internal |
628 } // namespace v8 | 648 } // namespace v8 |
OLD | NEW |