OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 14424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14435 Runtime_GetScriptFromScriptName(Handle<String>(script_name)); | 14435 Runtime_GetScriptFromScriptName(Handle<String>(script_name)); |
14436 return *result; | 14436 return *result; |
14437 } | 14437 } |
14438 | 14438 |
14439 | 14439 |
14440 // Collect the raw data for a stack trace. Returns an array of 4 | 14440 // Collect the raw data for a stack trace. Returns an array of 4 |
14441 // element segments each containing a receiver, function, code and | 14441 // element segments each containing a receiver, function, code and |
14442 // native code offset. | 14442 // native code offset. |
14443 RUNTIME_FUNCTION(Runtime_CollectStackTrace) { | 14443 RUNTIME_FUNCTION(Runtime_CollectStackTrace) { |
14444 HandleScope scope(isolate); | 14444 HandleScope scope(isolate); |
14445 ASSERT(args.length() == 3); | 14445 ASSERT(args.length() == 2); |
14446 CONVERT_ARG_HANDLE_CHECKED(JSObject, error_object, 0); | 14446 CONVERT_ARG_HANDLE_CHECKED(JSObject, error_object, 0); |
14447 CONVERT_ARG_HANDLE_CHECKED(Object, caller, 1); | 14447 CONVERT_ARG_HANDLE_CHECKED(Object, caller, 1); |
14448 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[2]); | |
14449 | 14448 |
14450 // Optionally capture a more detailed stack trace for the message. | 14449 // Optionally capture a more detailed stack trace for the message. |
14451 isolate->CaptureAndSetDetailedStackTrace(error_object); | 14450 isolate->CaptureAndSetDetailedStackTrace(error_object); |
14452 // Capture a simple stack trace for the stack property. | 14451 // Capture a simple stack trace for the stack property. |
14453 return *isolate->CaptureSimpleStackTrace(error_object, caller, limit); | 14452 isolate->CaptureAndSetSimpleStackTrace(error_object, caller); |
| 14453 return isolate->heap()->undefined_value(); |
14454 } | 14454 } |
14455 | 14455 |
14456 | 14456 |
14457 // Retrieve the stack trace. This is the raw stack trace that yet has to | |
14458 // be formatted. Since we only need this once, clear it afterwards. | |
14459 RUNTIME_FUNCTION(Runtime_GetAndClearOverflowedStackTrace) { | |
14460 HandleScope scope(isolate); | |
14461 ASSERT(args.length() == 1); | |
14462 CONVERT_ARG_HANDLE_CHECKED(JSObject, error_object, 0); | |
14463 Handle<String> key = isolate->factory()->hidden_stack_trace_string(); | |
14464 Handle<Object> result(error_object->GetHiddenProperty(key), isolate); | |
14465 if (result->IsTheHole()) return isolate->heap()->undefined_value(); | |
14466 RUNTIME_ASSERT(result->IsJSArray() || result->IsUndefined()); | |
14467 JSObject::DeleteHiddenProperty(error_object, key); | |
14468 return *result; | |
14469 } | |
14470 | |
14471 | |
14472 // Returns V8 version as a string. | 14457 // Returns V8 version as a string. |
14473 RUNTIME_FUNCTION(Runtime_GetV8Version) { | 14458 RUNTIME_FUNCTION(Runtime_GetV8Version) { |
14474 HandleScope scope(isolate); | 14459 HandleScope scope(isolate); |
14475 ASSERT(args.length() == 0); | 14460 ASSERT(args.length() == 0); |
14476 | 14461 |
14477 const char* version_string = v8::V8::GetVersion(); | 14462 const char* version_string = v8::V8::GetVersion(); |
14478 | 14463 |
14479 return *isolate->factory()->NewStringFromAsciiChecked(version_string); | 14464 return *isolate->factory()->NewStringFromAsciiChecked(version_string); |
14480 } | 14465 } |
14481 | 14466 |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15113 } | 15098 } |
15114 return NULL; | 15099 return NULL; |
15115 } | 15100 } |
15116 | 15101 |
15117 | 15102 |
15118 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15103 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15119 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15104 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15120 } | 15105 } |
15121 | 15106 |
15122 } } // namespace v8::internal | 15107 } } // namespace v8::internal |
OLD | NEW |