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

Side by Side Diff: src/builtins/builtins-function.cc

Issue 2396353002: Revert "Add Smi::Zero and replace all Smi::FromInt(0) calls" (Closed)
Patch Set: Created 4 years, 2 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/builtins/builtins-dataview.cc ('k') | src/builtins/builtins-math.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 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
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
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
OLDNEW
« no previous file with comments | « src/builtins/builtins-dataview.cc ('k') | src/builtins/builtins-math.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698