| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |