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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 this, js_builtins_object(), "$Error").ToHandleChecked(); | 785 this, js_builtins_object(), "$Error").ToHandleChecked(); |
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 int limit = FastD2IChecked(stack_trace_limit->Number()); |
796 int limit = std::isnan(dlimit) ? 0 : static_cast<int>(dlimit); | 796 if (limit < 0) limit = 0; |
797 | |
798 Handle<JSArray> stack_trace = CaptureSimpleStackTrace( | 797 Handle<JSArray> stack_trace = CaptureSimpleStackTrace( |
799 exception, factory()->undefined_value(), limit); | 798 exception, factory()->undefined_value(), limit); |
800 JSObject::SetHiddenProperty(exception, | 799 JSObject::SetHiddenProperty(exception, |
801 factory()->hidden_stack_trace_string(), | 800 factory()->hidden_stack_trace_string(), |
802 stack_trace); | 801 stack_trace); |
803 return heap()->exception(); | 802 return heap()->exception(); |
804 } | 803 } |
805 | 804 |
806 | 805 |
807 Object* Isolate::TerminateExecution() { | 806 Object* Isolate::TerminateExecution() { |
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2350 // The simulator uses a separate JS stack. | 2349 // The simulator uses a separate JS stack. |
2351 Address jssp_address = Simulator::current(isolate_)->get_sp(); | 2350 Address jssp_address = Simulator::current(isolate_)->get_sp(); |
2352 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); | 2351 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); |
2353 if (jssp < stack_guard->real_jslimit()) return true; | 2352 if (jssp < stack_guard->real_jslimit()) return true; |
2354 #endif // USE_SIMULATOR | 2353 #endif // USE_SIMULATOR |
2355 return reinterpret_cast<uintptr_t>(this) < stack_guard->real_climit(); | 2354 return reinterpret_cast<uintptr_t>(this) < stack_guard->real_climit(); |
2356 } | 2355 } |
2357 | 2356 |
2358 | 2357 |
2359 } } // namespace v8::internal | 2358 } } // namespace v8::internal |
OLD | NEW |