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