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/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
786 if (!error->IsJSObject()) return heap()->exception(); | 786 if (!error->IsJSObject()) return heap()->exception(); |
787 | 787 |
788 Handle<String> stackTraceLimit = | 788 Handle<String> stackTraceLimit = |
789 factory()->InternalizeUtf8String("stackTraceLimit"); | 789 factory()->InternalizeUtf8String("stackTraceLimit"); |
790 ASSERT(!stackTraceLimit.is_null()); | 790 ASSERT(!stackTraceLimit.is_null()); |
791 Handle<Object> stack_trace_limit = | 791 Handle<Object> stack_trace_limit = |
792 JSObject::GetDataProperty(Handle<JSObject>::cast(error), | 792 JSObject::GetDataProperty(Handle<JSObject>::cast(error), |
793 stackTraceLimit); | 793 stackTraceLimit); |
794 if (!stack_trace_limit->IsNumber()) return heap()->exception(); | 794 if (!stack_trace_limit->IsNumber()) return heap()->exception(); |
795 double dlimit = stack_trace_limit->Number(); | 795 double dlimit = stack_trace_limit->Number(); |
796 int limit = std::isnan(dlimit) ? 0 : static_cast<int>(dlimit); | 796 int limit; |
Yang
2014/06/18 12:07:39
Can we simply use FastD2IChecked here? Also, pleas
| |
797 | 797 if (std::isnan(dlimit) || dlimit < 0) |
798 limit = 0; | |
799 else if (dlimit > INT_MAX) | |
800 limit = INT_MAX; | |
801 else | |
802 limit = static_cast<int>(dlimit); | |
798 Handle<JSArray> stack_trace = CaptureSimpleStackTrace( | 803 Handle<JSArray> stack_trace = CaptureSimpleStackTrace( |
799 exception, factory()->undefined_value(), limit); | 804 exception, factory()->undefined_value(), limit); |
800 JSObject::SetHiddenProperty(exception, | 805 JSObject::SetHiddenProperty(exception, |
801 factory()->hidden_stack_trace_string(), | 806 factory()->hidden_stack_trace_string(), |
802 stack_trace); | 807 stack_trace); |
803 return heap()->exception(); | 808 return heap()->exception(); |
804 } | 809 } |
805 | 810 |
806 | 811 |
807 Object* Isolate::TerminateExecution() { | 812 Object* Isolate::TerminateExecution() { |
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2350 // The simulator uses a separate JS stack. | 2355 // The simulator uses a separate JS stack. |
2351 Address jssp_address = Simulator::current(isolate_)->get_sp(); | 2356 Address jssp_address = Simulator::current(isolate_)->get_sp(); |
2352 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); | 2357 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); |
2353 if (jssp < stack_guard->real_jslimit()) return true; | 2358 if (jssp < stack_guard->real_jslimit()) return true; |
2354 #endif // USE_SIMULATOR | 2359 #endif // USE_SIMULATOR |
2355 return reinterpret_cast<uintptr_t>(this) < stack_guard->real_climit(); | 2360 return reinterpret_cast<uintptr_t>(this) < stack_guard->real_climit(); |
2356 } | 2361 } |
2357 | 2362 |
2358 | 2363 |
2359 } } // namespace v8::internal | 2364 } } // namespace v8::internal |
OLD | NEW |