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

Side by Side Diff: src/code-stub-assembler.cc

Issue 2372543002: [stubs] Add SmiMax and refactor SmiMin to use Select (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/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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 350 }
351 351
352 Node* CodeStubAssembler::SmiLessThan(Node* a, Node* b) { 352 Node* CodeStubAssembler::SmiLessThan(Node* a, Node* b) {
353 return IntPtrLessThan(a, b); 353 return IntPtrLessThan(a, b);
354 } 354 }
355 355
356 Node* CodeStubAssembler::SmiLessThanOrEqual(Node* a, Node* b) { 356 Node* CodeStubAssembler::SmiLessThanOrEqual(Node* a, Node* b) {
357 return IntPtrLessThanOrEqual(a, b); 357 return IntPtrLessThanOrEqual(a, b);
358 } 358 }
359 359
360 Node* CodeStubAssembler::SmiMax(Node* a, Node* b) {
361 Variable max(this, MachineRepresentation::kTagged);
362 max.Bind(Select(SmiLessThan(a, b), b, a));
Igor Sheludko 2016/09/27 11:40:03 I guess you can just return a Select node.
jgruber 2016/09/27 13:35:46 Done.
363 return max.value();
364 }
365
360 Node* CodeStubAssembler::SmiMin(Node* a, Node* b) { 366 Node* CodeStubAssembler::SmiMin(Node* a, Node* b) {
361 // TODO(bmeurer): Consider using Select once available.
362 Variable min(this, MachineRepresentation::kTagged); 367 Variable min(this, MachineRepresentation::kTagged);
363 Label if_a(this), if_b(this), join(this); 368 min.Bind(Select(SmiLessThan(a, b), a, b));
Igor Sheludko 2016/09/27 11:40:03 Same here.
jgruber 2016/09/27 13:35:46 Done.
364 BranchIfSmiLessThan(a, b, &if_a, &if_b);
365 Bind(&if_a);
366 min.Bind(a);
367 Goto(&join);
368 Bind(&if_b);
369 min.Bind(b);
370 Goto(&join);
371 Bind(&join);
372 return min.value(); 369 return min.value();
373 } 370 }
374 371
375 Node* CodeStubAssembler::SmiMod(Node* a, Node* b) { 372 Node* CodeStubAssembler::SmiMod(Node* a, Node* b) {
376 Variable var_result(this, MachineRepresentation::kTagged); 373 Variable var_result(this, MachineRepresentation::kTagged);
377 Label return_result(this, &var_result), 374 Label return_result(this, &var_result),
378 return_minuszero(this, Label::kDeferred), 375 return_minuszero(this, Label::kDeferred),
379 return_nan(this, Label::kDeferred); 376 return_nan(this, Label::kDeferred);
380 377
381 // Untag {a} and {b}. 378 // Untag {a} and {b}.
(...skipping 5264 matching lines...) Expand 10 before | Expand all | Expand 10 after
5646 Heap::kTheHoleValueRootIndex); 5643 Heap::kTheHoleValueRootIndex);
5647 5644
5648 // Store the WeakCell in the feedback vector. 5645 // Store the WeakCell in the feedback vector.
5649 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 5646 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER,
5650 CodeStubAssembler::SMI_PARAMETERS); 5647 CodeStubAssembler::SMI_PARAMETERS);
5651 return cell; 5648 return cell;
5652 } 5649 }
5653 5650
5654 } // namespace internal 5651 } // namespace internal
5655 } // namespace v8 5652 } // 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