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 "src/accessors.h" | 5 #include "src/accessors.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/contexts.h" | 8 #include "src/contexts.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/execution.h" | 10 #include "src/execution.h" |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
730 | 730 |
731 | 731 |
732 void Accessors::FunctionLengthGetter( | 732 void Accessors::FunctionLengthGetter( |
733 v8::Local<v8::Name> name, | 733 v8::Local<v8::Name> name, |
734 const v8::PropertyCallbackInfo<v8::Value>& info) { | 734 const v8::PropertyCallbackInfo<v8::Value>& info) { |
735 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 735 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
736 HandleScope scope(isolate); | 736 HandleScope scope(isolate); |
737 Handle<JSFunction> function = | 737 Handle<JSFunction> function = |
738 Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder())); | 738 Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder())); |
739 Handle<Object> result; | 739 Handle<Object> result; |
740 if (!JSFunction::GetLength(isolate, function).ToHandle(&result)) { | 740 // This may invoke the compiler, so check for stack overflow like other |
741 // compiler entrypoints, and return 0 on failure (as on an exception). | |
742 StackLimitCheck check(isolate); | |
743 if (check.JsHasOverflowed(1 * KB)) { | |
744 result = handle(Smi::FromInt(0), isolate); | |
caitp
2016/08/12 01:57:10
thinking about this, we only want to return 0 if c
Dan Ehrenberg
2016/08/12 02:20:47
I backed out this change in the most recent versio
| |
745 } else if (!JSFunction::GetLength(isolate, function).ToHandle(&result)) { | |
741 result = handle(Smi::FromInt(0), isolate); | 746 result = handle(Smi::FromInt(0), isolate); |
742 isolate->OptionalRescheduleException(false); | 747 isolate->OptionalRescheduleException(false); |
743 } | 748 } |
744 | 749 |
745 info.GetReturnValue().Set(Utils::ToLocal(result)); | 750 info.GetReturnValue().Set(Utils::ToLocal(result)); |
746 } | 751 } |
747 | 752 |
748 Handle<AccessorInfo> Accessors::FunctionLengthInfo( | 753 Handle<AccessorInfo> Accessors::FunctionLengthInfo( |
749 Isolate* isolate, PropertyAttributes attributes) { | 754 Isolate* isolate, PropertyAttributes attributes) { |
750 return MakeAccessor(isolate, isolate->factory()->length_string(), | 755 return MakeAccessor(isolate, isolate->factory()->length_string(), |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1227 Handle<AccessorInfo> Accessors::ErrorStackInfo(Isolate* isolate, | 1232 Handle<AccessorInfo> Accessors::ErrorStackInfo(Isolate* isolate, |
1228 PropertyAttributes attributes) { | 1233 PropertyAttributes attributes) { |
1229 Handle<AccessorInfo> info = | 1234 Handle<AccessorInfo> info = |
1230 MakeAccessor(isolate, isolate->factory()->stack_string(), | 1235 MakeAccessor(isolate, isolate->factory()->stack_string(), |
1231 &ErrorStackGetter, &ErrorStackSetter, attributes); | 1236 &ErrorStackGetter, &ErrorStackSetter, attributes); |
1232 return info; | 1237 return info; |
1233 } | 1238 } |
1234 | 1239 |
1235 } // namespace internal | 1240 } // namespace internal |
1236 } // namespace v8 | 1241 } // namespace v8 |
OLD | NEW |