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 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 } | 417 } |
418 | 418 |
419 | 419 |
420 void Isolate::CaptureAndSetDetailedStackTrace(Handle<JSObject> error_object) { | 420 void Isolate::CaptureAndSetDetailedStackTrace(Handle<JSObject> error_object) { |
421 if (capture_stack_trace_for_uncaught_exceptions_) { | 421 if (capture_stack_trace_for_uncaught_exceptions_) { |
422 // Capture stack trace for a detailed exception message. | 422 // Capture stack trace for a detailed exception message. |
423 Handle<Name> key = factory()->detailed_stack_trace_symbol(); | 423 Handle<Name> key = factory()->detailed_stack_trace_symbol(); |
424 Handle<JSArray> stack_trace = CaptureCurrentStackTrace( | 424 Handle<JSArray> stack_trace = CaptureCurrentStackTrace( |
425 stack_trace_for_uncaught_exceptions_frame_limit_, | 425 stack_trace_for_uncaught_exceptions_frame_limit_, |
426 stack_trace_for_uncaught_exceptions_options_); | 426 stack_trace_for_uncaught_exceptions_options_); |
427 JSObject::SetProperty( | 427 JSObject::SetProperty(error_object, key, stack_trace, STRICT).Assert(); |
428 error_object, key, stack_trace, NONE, STRICT).Assert(); | |
429 } | 428 } |
430 } | 429 } |
431 | 430 |
432 | 431 |
433 void Isolate::CaptureAndSetSimpleStackTrace(Handle<JSObject> error_object, | 432 void Isolate::CaptureAndSetSimpleStackTrace(Handle<JSObject> error_object, |
434 Handle<Object> caller) { | 433 Handle<Object> caller) { |
435 // Capture stack trace for simple stack trace string formatting. | 434 // Capture stack trace for simple stack trace string formatting. |
436 Handle<Name> key = factory()->stack_trace_symbol(); | 435 Handle<Name> key = factory()->stack_trace_symbol(); |
437 Handle<Object> stack_trace = CaptureSimpleStackTrace(error_object, caller); | 436 Handle<Object> stack_trace = CaptureSimpleStackTrace(error_object, caller); |
438 JSObject::SetProperty(error_object, key, stack_trace, NONE, STRICT).Assert(); | 437 JSObject::SetProperty(error_object, key, stack_trace, STRICT).Assert(); |
439 } | 438 } |
440 | 439 |
441 | 440 |
442 Handle<JSArray> Isolate::CaptureCurrentStackTrace( | 441 Handle<JSArray> Isolate::CaptureCurrentStackTrace( |
443 int frame_limit, StackTrace::StackTraceOptions options) { | 442 int frame_limit, StackTrace::StackTraceOptions options) { |
444 // Ensure no negative values. | 443 // Ensure no negative values. |
445 int limit = Max(frame_limit, 0); | 444 int limit = Max(frame_limit, 0); |
446 Handle<JSArray> stack_trace = factory()->NewJSArray(frame_limit); | 445 Handle<JSArray> stack_trace = factory()->NewJSArray(frame_limit); |
447 | 446 |
448 Handle<String> column_key = | 447 Handle<String> column_key = |
(...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2200 Handle<JSObject> registry = factory()->NewJSObjectFromMap(map); | 2199 Handle<JSObject> registry = factory()->NewJSObjectFromMap(map); |
2201 heap()->set_symbol_registry(*registry); | 2200 heap()->set_symbol_registry(*registry); |
2202 | 2201 |
2203 static const char* nested[] = { | 2202 static const char* nested[] = { |
2204 "for", "for_api", "for_intern", "keyFor", "private_api", "private_intern" | 2203 "for", "for_api", "for_intern", "keyFor", "private_api", "private_intern" |
2205 }; | 2204 }; |
2206 for (unsigned i = 0; i < ARRAY_SIZE(nested); ++i) { | 2205 for (unsigned i = 0; i < ARRAY_SIZE(nested); ++i) { |
2207 Handle<String> name = factory()->InternalizeUtf8String(nested[i]); | 2206 Handle<String> name = factory()->InternalizeUtf8String(nested[i]); |
2208 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map); | 2207 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map); |
2209 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8); | 2208 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8); |
2210 JSObject::SetProperty(registry, name, obj, NONE, STRICT).Assert(); | 2209 JSObject::SetProperty(registry, name, obj, STRICT).Assert(); |
2211 } | 2210 } |
2212 } | 2211 } |
2213 return Handle<JSObject>::cast(factory()->symbol_registry()); | 2212 return Handle<JSObject>::cast(factory()->symbol_registry()); |
2214 } | 2213 } |
2215 | 2214 |
2216 | 2215 |
2217 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) { | 2216 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) { |
2218 for (int i = 0; i < call_completed_callbacks_.length(); i++) { | 2217 for (int i = 0; i < call_completed_callbacks_.length(); i++) { |
2219 if (callback == call_completed_callbacks_.at(i)) return; | 2218 if (callback == call_completed_callbacks_.at(i)) return; |
2220 } | 2219 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2349 if (prev_ && prev_->Intercept(flag)) return true; | 2348 if (prev_ && prev_->Intercept(flag)) return true; |
2350 // Then check whether this scope intercepts. | 2349 // Then check whether this scope intercepts. |
2351 if ((flag & intercept_mask_)) { | 2350 if ((flag & intercept_mask_)) { |
2352 intercepted_flags_ |= flag; | 2351 intercepted_flags_ |= flag; |
2353 return true; | 2352 return true; |
2354 } | 2353 } |
2355 return false; | 2354 return false; |
2356 } | 2355 } |
2357 | 2356 |
2358 } } // namespace v8::internal | 2357 } } // namespace v8::internal |
OLD | NEW |