OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/builtins.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
7 | 7 |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/string-builder.h" | 9 #include "src/string-builder.h" |
10 | 10 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 LookupIterator length_lookup(target, isolate->factory()->length_string(), | 192 LookupIterator length_lookup(target, isolate->factory()->length_string(), |
193 target, LookupIterator::OWN); | 193 target, LookupIterator::OWN); |
194 // Setup the "length" property based on the "length" of the {target}. | 194 // Setup the "length" property based on the "length" of the {target}. |
195 // If the targets length is the default JSFunction accessor, we can keep the | 195 // If the targets length is the default JSFunction accessor, we can keep the |
196 // accessor that's installed by default on the JSBoundFunction. It lazily | 196 // accessor that's installed by default on the JSBoundFunction. It lazily |
197 // computes the value from the underlying internal length. | 197 // computes the value from the underlying internal length. |
198 if (!target->IsJSFunction() || | 198 if (!target->IsJSFunction() || |
199 length_lookup.state() != LookupIterator::ACCESSOR || | 199 length_lookup.state() != LookupIterator::ACCESSOR || |
200 !length_lookup.GetAccessors()->IsAccessorInfo()) { | 200 !length_lookup.GetAccessors()->IsAccessorInfo()) { |
201 Handle<Object> length(Smi::kZero, isolate); | 201 Handle<Object> length(Smi::FromInt(0), isolate); |
202 Maybe<PropertyAttributes> attributes = | 202 Maybe<PropertyAttributes> attributes = |
203 JSReceiver::GetPropertyAttributes(&length_lookup); | 203 JSReceiver::GetPropertyAttributes(&length_lookup); |
204 if (!attributes.IsJust()) return isolate->heap()->exception(); | 204 if (!attributes.IsJust()) return isolate->heap()->exception(); |
205 if (attributes.FromJust() != ABSENT) { | 205 if (attributes.FromJust() != ABSENT) { |
206 Handle<Object> target_length; | 206 Handle<Object> target_length; |
207 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, target_length, | 207 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, target_length, |
208 Object::GetProperty(&length_lookup)); | 208 Object::GetProperty(&length_lookup)); |
209 if (target_length->IsNumber()) { | 209 if (target_length->IsNumber()) { |
210 length = isolate->factory()->NewNumber(std::max( | 210 length = isolate->factory()->NewNumber(std::max( |
211 0.0, DoubleToInteger(target_length->Number()) - argv.length())); | 211 0.0, DoubleToInteger(target_length->Number()) - argv.length())); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 Node* f = assembler->Parameter(0); | 289 Node* f = assembler->Parameter(0); |
290 Node* v = assembler->Parameter(1); | 290 Node* v = assembler->Parameter(1); |
291 Node* context = assembler->Parameter(4); | 291 Node* context = assembler->Parameter(4); |
292 Node* result = assembler->OrdinaryHasInstance(context, f, v); | 292 Node* result = assembler->OrdinaryHasInstance(context, f, v); |
293 assembler->Return(result); | 293 assembler->Return(result); |
294 } | 294 } |
295 | 295 |
296 } // namespace internal | 296 } // namespace internal |
297 } // namespace v8 | 297 } // namespace v8 |
OLD | NEW |