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 14410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14421 Runtime_GetScriptFromScriptName(Handle<String>(script_name)); | 14421 Runtime_GetScriptFromScriptName(Handle<String>(script_name)); |
14422 return *result; | 14422 return *result; |
14423 } | 14423 } |
14424 | 14424 |
14425 | 14425 |
14426 // Collect the raw data for a stack trace. Returns an array of 4 | 14426 // Collect the raw data for a stack trace. Returns an array of 4 |
14427 // element segments each containing a receiver, function, code and | 14427 // element segments each containing a receiver, function, code and |
14428 // native code offset. | 14428 // native code offset. |
14429 RUNTIME_FUNCTION(Runtime_CollectStackTrace) { | 14429 RUNTIME_FUNCTION(Runtime_CollectStackTrace) { |
14430 HandleScope scope(isolate); | 14430 HandleScope scope(isolate); |
14431 ASSERT(args.length() == 3); | 14431 ASSERT(args.length() == 2); |
14432 CONVERT_ARG_HANDLE_CHECKED(JSObject, error_object, 0); | 14432 CONVERT_ARG_HANDLE_CHECKED(JSObject, error_object, 0); |
14433 CONVERT_ARG_HANDLE_CHECKED(Object, caller, 1); | 14433 CONVERT_ARG_HANDLE_CHECKED(Object, caller, 1); |
14434 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[2]); | |
14435 | 14434 |
14436 // Optionally capture a more detailed stack trace for the message. | 14435 // Optionally capture a more detailed stack trace for the message. |
14437 isolate->CaptureAndSetDetailedStackTrace(error_object); | 14436 isolate->CaptureAndSetDetailedStackTrace(error_object); |
14438 // Capture a simple stack trace for the stack property. | 14437 // Capture a simple stack trace for the stack property. |
14439 return *isolate->CaptureSimpleStackTrace(error_object, caller, limit); | 14438 isolate->CaptureAndSetSimpleStackTrace(error_object, caller); |
| 14439 return isolate->heap()->undefined_value(); |
14440 } | 14440 } |
14441 | 14441 |
14442 | 14442 |
14443 // Retrieve the stack trace. This is the raw stack trace that yet has to | |
14444 // be formatted. Since we only need this once, clear it afterwards. | |
14445 RUNTIME_FUNCTION(Runtime_GetAndClearOverflowedStackTrace) { | |
14446 HandleScope scope(isolate); | |
14447 ASSERT(args.length() == 1); | |
14448 CONVERT_ARG_HANDLE_CHECKED(JSObject, error_object, 0); | |
14449 Handle<String> key = isolate->factory()->hidden_stack_trace_string(); | |
14450 Handle<Object> result(error_object->GetHiddenProperty(key), isolate); | |
14451 if (result->IsTheHole()) return isolate->heap()->undefined_value(); | |
14452 RUNTIME_ASSERT(result->IsJSArray() || result->IsUndefined()); | |
14453 JSObject::DeleteHiddenProperty(error_object, key); | |
14454 return *result; | |
14455 } | |
14456 | |
14457 | |
14458 // Returns V8 version as a string. | 14443 // Returns V8 version as a string. |
14459 RUNTIME_FUNCTION(Runtime_GetV8Version) { | 14444 RUNTIME_FUNCTION(Runtime_GetV8Version) { |
14460 HandleScope scope(isolate); | 14445 HandleScope scope(isolate); |
14461 ASSERT(args.length() == 0); | 14446 ASSERT(args.length() == 0); |
14462 | 14447 |
14463 const char* version_string = v8::V8::GetVersion(); | 14448 const char* version_string = v8::V8::GetVersion(); |
14464 | 14449 |
14465 return *isolate->factory()->NewStringFromAsciiChecked(version_string); | 14450 return *isolate->factory()->NewStringFromAsciiChecked(version_string); |
14466 } | 14451 } |
14467 | 14452 |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15099 } | 15084 } |
15100 return NULL; | 15085 return NULL; |
15101 } | 15086 } |
15102 | 15087 |
15103 | 15088 |
15104 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15089 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15105 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15090 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15106 } | 15091 } |
15107 | 15092 |
15108 } } // namespace v8::internal | 15093 } } // namespace v8::internal |
OLD | NEW |