Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: src/builtins.cc

Issue 1975763002: [runtime] Make sure that LookupIterator::OWN always performs a HIDDEN lookup as well. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/accessors.cc ('k') | src/compiler/js-global-object-specialization.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/compiler/js-global-object-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698