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/code-stub-assembler.cc

Issue 2372543002: [stubs] Add SmiMax and refactor SmiMin to use Select (Closed)
Patch Set: Address comments 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/code-stub-assembler.h ('k') | no next file » | 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/code-stub-assembler.h" 5 #include "src/code-stub-assembler.h"
6 #include "src/code-factory.h" 6 #include "src/code-factory.h"
7 #include "src/frames-inl.h" 7 #include "src/frames-inl.h"
8 #include "src/frames.h" 8 #include "src/frames.h"
9 #include "src/ic/handler-configuration.h" 9 #include "src/ic/handler-configuration.h"
10 #include "src/ic/stub-cache.h" 10 #include "src/ic/stub-cache.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 342 }
343 343
344 Node* CodeStubAssembler::SmiLessThan(Node* a, Node* b) { 344 Node* CodeStubAssembler::SmiLessThan(Node* a, Node* b) {
345 return IntPtrLessThan(a, b); 345 return IntPtrLessThan(a, b);
346 } 346 }
347 347
348 Node* CodeStubAssembler::SmiLessThanOrEqual(Node* a, Node* b) { 348 Node* CodeStubAssembler::SmiLessThanOrEqual(Node* a, Node* b) {
349 return IntPtrLessThanOrEqual(a, b); 349 return IntPtrLessThanOrEqual(a, b);
350 } 350 }
351 351
352 Node* CodeStubAssembler::SmiMax(Node* a, Node* b) {
353 return Select(SmiLessThan(a, b), b, a);
354 }
355
352 Node* CodeStubAssembler::SmiMin(Node* a, Node* b) { 356 Node* CodeStubAssembler::SmiMin(Node* a, Node* b) {
353 // TODO(bmeurer): Consider using Select once available. 357 return Select(SmiLessThan(a, b), a, b);
354 Variable min(this, MachineRepresentation::kTagged);
355 Label if_a(this), if_b(this), join(this);
356 BranchIfSmiLessThan(a, b, &if_a, &if_b);
357 Bind(&if_a);
358 min.Bind(a);
359 Goto(&join);
360 Bind(&if_b);
361 min.Bind(b);
362 Goto(&join);
363 Bind(&join);
364 return min.value();
365 } 358 }
366 359
367 Node* CodeStubAssembler::SmiMod(Node* a, Node* b) { 360 Node* CodeStubAssembler::SmiMod(Node* a, Node* b) {
368 Variable var_result(this, MachineRepresentation::kTagged); 361 Variable var_result(this, MachineRepresentation::kTagged);
369 Label return_result(this, &var_result), 362 Label return_result(this, &var_result),
370 return_minuszero(this, Label::kDeferred), 363 return_minuszero(this, Label::kDeferred),
371 return_nan(this, Label::kDeferred); 364 return_nan(this, Label::kDeferred);
372 365
373 // Untag {a} and {b}. 366 // Untag {a} and {b}.
374 a = SmiToWord32(a); 367 a = SmiToWord32(a);
(...skipping 5014 matching lines...) Expand 10 before | Expand all | Expand 10 after
5389 Heap::kTheHoleValueRootIndex); 5382 Heap::kTheHoleValueRootIndex);
5390 5383
5391 // Store the WeakCell in the feedback vector. 5384 // Store the WeakCell in the feedback vector.
5392 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 5385 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER,
5393 CodeStubAssembler::SMI_PARAMETERS); 5386 CodeStubAssembler::SMI_PARAMETERS);
5394 return cell; 5387 return cell;
5395 } 5388 }
5396 5389
5397 } // namespace internal 5390 } // namespace internal
5398 } // namespace v8 5391 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698