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...) 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); | |
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 | 368 |
389 RUNTIME_FUNCTION(Runtime_MessageGetStartPosition) { | 369 RUNTIME_FUNCTION(Runtime_MessageGetStartPosition) { |
390 SealHandleScope shs(isolate); | 370 SealHandleScope shs(isolate); |
391 DCHECK(args.length() == 1); | 371 DCHECK(args.length() == 1); |
392 CONVERT_ARG_CHECKED(JSMessageObject, message, 0); | 372 CONVERT_ARG_CHECKED(JSMessageObject, message, 0); |
393 return Smi::FromInt(message->start_position()); | 373 return Smi::FromInt(message->start_position()); |
394 } | 374 } |
395 | 375 |
396 | 376 |
397 RUNTIME_FUNCTION(Runtime_MessageGetScript) { | 377 RUNTIME_FUNCTION(Runtime_MessageGetScript) { |
(...skipping 241 matching lines...) Loading... |
639 HandleScope scope(isolate); | 619 HandleScope scope(isolate); |
640 DCHECK_EQ(1, args.length()); | 620 DCHECK_EQ(1, args.length()); |
641 CONVERT_ARG_CHECKED(Object, object, 0); | 621 CONVERT_ARG_CHECKED(Object, object, 0); |
642 bool is_wasm_object = | 622 bool is_wasm_object = |
643 object->IsJSObject() && wasm::IsWasmObject(JSObject::cast(object)); | 623 object->IsJSObject() && wasm::IsWasmObject(JSObject::cast(object)); |
644 return *isolate->factory()->ToBoolean(is_wasm_object); | 624 return *isolate->factory()->ToBoolean(is_wasm_object); |
645 } | 625 } |
646 | 626 |
647 } // namespace internal | 627 } // namespace internal |
648 } // namespace v8 | 628 } // namespace v8 |
OLD | NEW |