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

Side by Side Diff: src/builtins/builtins-array-gen.cc

Issue 2874423003: [csa] Add ToLength and ToString variants with inlined fast checks (Closed)
Patch Set: ToString Created 3 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 | « no previous file | src/builtins/builtins-conversion-gen.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 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 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-utils-gen.h" 5 #include "src/builtins/builtins-utils-gen.h"
6 #include "src/builtins/builtins.h" 6 #include "src/builtins/builtins.h"
7 #include "src/code-stub-assembler.h" 7 #include "src/code-stub-assembler.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 // 3. Let len be ToLength(Get(O, "length")). 325 // 3. Let len be ToLength(Get(O, "length")).
326 // 4. ReturnIfAbrupt(len). 326 // 4. ReturnIfAbrupt(len).
327 VARIABLE(merged_length, MachineRepresentation::kTagged); 327 VARIABLE(merged_length, MachineRepresentation::kTagged);
328 Label has_length(this, &merged_length), not_js_array(this); 328 Label has_length(this, &merged_length), not_js_array(this);
329 GotoIf(DoesntHaveInstanceType(o(), JS_ARRAY_TYPE), &not_js_array); 329 GotoIf(DoesntHaveInstanceType(o(), JS_ARRAY_TYPE), &not_js_array);
330 merged_length.Bind(LoadJSArrayLength(o())); 330 merged_length.Bind(LoadJSArrayLength(o()));
331 Goto(&has_length); 331 Goto(&has_length);
332 BIND(&not_js_array); 332 BIND(&not_js_array);
333 Node* len_property = 333 Node* len_property =
334 GetProperty(context(), o(), isolate()->factory()->length_string()); 334 GetProperty(context(), o(), isolate()->factory()->length_string());
335 merged_length.Bind( 335 merged_length.Bind(ToLength_Inline(context(), len_property));
336 CallStub(CodeFactory::ToLength(isolate()), context(), len_property));
337 Goto(&has_length); 336 Goto(&has_length);
338 BIND(&has_length); 337 BIND(&has_length);
339 len_ = merged_length.value(); 338 len_ = merged_length.value();
340 339
341 // 5. If IsCallable(callbackfn) is false, throw a TypeError exception. 340 // 5. If IsCallable(callbackfn) is false, throw a TypeError exception.
342 Label type_exception(this, Label::kDeferred); 341 Label type_exception(this, Label::kDeferred);
343 Label done(this); 342 Label done(this);
344 GotoIf(TaggedIsSmi(callbackfn()), &type_exception); 343 GotoIf(TaggedIsSmi(callbackfn()), &type_exception);
345 Branch(IsCallableMap(LoadMap(callbackfn())), &done, &type_exception); 344 Branch(IsCallableMap(LoadMap(callbackfn())), &done, &type_exception);
346 345
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 Node* cell = LoadRoot(Heap::kFastArrayIterationProtectorRootIndex); 2173 Node* cell = LoadRoot(Heap::kFastArrayIterationProtectorRootIndex);
2175 StoreObjectFieldNoWriteBarrier(cell, Cell::kValueOffset, invalid); 2174 StoreObjectFieldNoWriteBarrier(cell, Cell::kValueOffset, invalid);
2176 Goto(&done); 2175 Goto(&done);
2177 } 2176 }
2178 } 2177 }
2179 2178
2180 BIND(&if_isnotarray); 2179 BIND(&if_isnotarray);
2181 { 2180 {
2182 Node* length = 2181 Node* length =
2183 GetProperty(context, array, factory()->length_string()); 2182 GetProperty(context, array, factory()->length_string());
2184 Callable to_length = CodeFactory::ToLength(isolate()); 2183 var_length.Bind(ToLength_Inline(context, length));
2185 var_length.Bind(CallStub(to_length, context, length));
2186 Goto(&done); 2184 Goto(&done);
2187 } 2185 }
2188 2186
2189 BIND(&done); 2187 BIND(&done);
2190 length = var_length.value(); 2188 length = var_length.value();
2191 } 2189 }
2192 2190
2193 GotoUnlessNumberLessThan(index, length, &set_done); 2191 GotoUnlessNumberLessThan(index, length, &set_done);
2194 2192
2195 StoreObjectField(iterator, JSArrayIterator::kNextIndexOffset, 2193 StoreObjectField(iterator, JSArrayIterator::kNextIndexOffset,
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
2400 { 2398 {
2401 Node* message = SmiConstant(MessageTemplate::kDetachedOperation); 2399 Node* message = SmiConstant(MessageTemplate::kDetachedOperation);
2402 CallRuntime(Runtime::kThrowTypeError, context, message, 2400 CallRuntime(Runtime::kThrowTypeError, context, message,
2403 HeapConstant(operation)); 2401 HeapConstant(operation));
2404 Unreachable(); 2402 Unreachable();
2405 } 2403 }
2406 } 2404 }
2407 2405
2408 } // namespace internal 2406 } // namespace internal
2409 } // namespace v8 2407 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins-conversion-gen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698