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/builtins.h" | 5 #include "src/builtins.h" |
6 | 6 |
7 #include "src/api-arguments.h" | 7 #include "src/api-arguments.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 4119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4130 for (int i = 2; i < args.length(); ++i) { | 4130 for (int i = 2; i < args.length(); ++i) { |
4131 argv[i - 2] = args.at<Object>(i); | 4131 argv[i - 2] = args.at<Object>(i); |
4132 } | 4132 } |
4133 } | 4133 } |
4134 Handle<JSBoundFunction> function; | 4134 Handle<JSBoundFunction> function; |
4135 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 4135 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
4136 isolate, function, | 4136 isolate, function, |
4137 isolate->factory()->NewJSBoundFunction(target, this_arg, argv)); | 4137 isolate->factory()->NewJSBoundFunction(target, this_arg, argv)); |
4138 | 4138 |
4139 LookupIterator length_lookup(target, isolate->factory()->length_string(), | 4139 LookupIterator length_lookup(target, isolate->factory()->length_string(), |
4140 target, LookupIterator::HIDDEN); | 4140 target, LookupIterator::OWN); |
4141 // Setup the "length" property based on the "length" of the {target}. | 4141 // Setup the "length" property based on the "length" of the {target}. |
4142 // If the targets length is the default JSFunction accessor, we can keep the | 4142 // If the targets length is the default JSFunction accessor, we can keep the |
4143 // accessor that's installed by default on the JSBoundFunction. It lazily | 4143 // accessor that's installed by default on the JSBoundFunction. It lazily |
4144 // computes the value from the underlying internal length. | 4144 // computes the value from the underlying internal length. |
4145 if (!target->IsJSFunction() || | 4145 if (!target->IsJSFunction() || |
4146 length_lookup.state() != LookupIterator::ACCESSOR || | 4146 length_lookup.state() != LookupIterator::ACCESSOR || |
4147 !length_lookup.GetAccessors()->IsAccessorInfo()) { | 4147 !length_lookup.GetAccessors()->IsAccessorInfo()) { |
4148 Handle<Object> length(Smi::FromInt(0), isolate); | 4148 Handle<Object> length(Smi::FromInt(0), isolate); |
4149 Maybe<PropertyAttributes> attributes = | 4149 Maybe<PropertyAttributes> attributes = |
4150 JSReceiver::GetPropertyAttributes(&length_lookup); | 4150 JSReceiver::GetPropertyAttributes(&length_lookup); |
(...skipping 12 matching lines...) Expand all Loading... |
4163 RETURN_FAILURE_ON_EXCEPTION(isolate, | 4163 RETURN_FAILURE_ON_EXCEPTION(isolate, |
4164 JSObject::DefineOwnPropertyIgnoreAttributes( | 4164 JSObject::DefineOwnPropertyIgnoreAttributes( |
4165 &it, length, it.property_attributes())); | 4165 &it, length, it.property_attributes())); |
4166 } | 4166 } |
4167 | 4167 |
4168 // Setup the "name" property based on the "name" of the {target}. | 4168 // Setup the "name" property based on the "name" of the {target}. |
4169 // If the targets name is the default JSFunction accessor, we can keep the | 4169 // If the targets name is the default JSFunction accessor, we can keep the |
4170 // accessor that's installed by default on the JSBoundFunction. It lazily | 4170 // accessor that's installed by default on the JSBoundFunction. It lazily |
4171 // computes the value from the underlying internal name. | 4171 // computes the value from the underlying internal name. |
4172 LookupIterator name_lookup(target, isolate->factory()->name_string(), target, | 4172 LookupIterator name_lookup(target, isolate->factory()->name_string(), target, |
4173 LookupIterator::HIDDEN); | 4173 LookupIterator::OWN); |
4174 if (!target->IsJSFunction() || | 4174 if (!target->IsJSFunction() || |
4175 name_lookup.state() != LookupIterator::ACCESSOR || | 4175 name_lookup.state() != LookupIterator::ACCESSOR || |
4176 !name_lookup.GetAccessors()->IsAccessorInfo()) { | 4176 !name_lookup.GetAccessors()->IsAccessorInfo()) { |
4177 Handle<Object> target_name; | 4177 Handle<Object> target_name; |
4178 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, target_name, | 4178 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, target_name, |
4179 Object::GetProperty(&name_lookup)); | 4179 Object::GetProperty(&name_lookup)); |
4180 Handle<String> name; | 4180 Handle<String> name; |
4181 if (target_name->IsString()) { | 4181 if (target_name->IsString()) { |
4182 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 4182 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
4183 isolate, name, | 4183 isolate, name, |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5478 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) | 5478 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) |
5479 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 5479 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
5480 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 5480 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
5481 #undef DEFINE_BUILTIN_ACCESSOR_C | 5481 #undef DEFINE_BUILTIN_ACCESSOR_C |
5482 #undef DEFINE_BUILTIN_ACCESSOR_A | 5482 #undef DEFINE_BUILTIN_ACCESSOR_A |
5483 #undef DEFINE_BUILTIN_ACCESSOR_T | 5483 #undef DEFINE_BUILTIN_ACCESSOR_T |
5484 #undef DEFINE_BUILTIN_ACCESSOR_H | 5484 #undef DEFINE_BUILTIN_ACCESSOR_H |
5485 | 5485 |
5486 } // namespace internal | 5486 } // namespace internal |
5487 } // namespace v8 | 5487 } // namespace v8 |
OLD | NEW |