| 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 20 matching lines...) Expand all Loading... |
| 31 Label ok(this); | 31 Label ok(this); |
| 32 Comment("[ Assert"); | 32 Comment("[ Assert"); |
| 33 GotoIf(condition, &ok); | 33 GotoIf(condition, &ok); |
| 34 DebugBreak(); | 34 DebugBreak(); |
| 35 Goto(&ok); | 35 Goto(&ok); |
| 36 Bind(&ok); | 36 Bind(&ok); |
| 37 Comment("] Assert"); | 37 Comment("] Assert"); |
| 38 #endif | 38 #endif |
| 39 } | 39 } |
| 40 | 40 |
| 41 Node* CodeStubAssembler::NoContextConstant() { return SmiConstant(Smi::kZero); } | 41 Node* CodeStubAssembler::NoContextConstant() { return NumberConstant(0); } |
| 42 | 42 |
| 43 #define HEAP_CONSTANT_ACCESSOR(rootName, name) \ | 43 #define HEAP_CONSTANT_ACCESSOR(rootName, name) \ |
| 44 Node* CodeStubAssembler::name##Constant() { \ | 44 Node* CodeStubAssembler::name##Constant() { \ |
| 45 return LoadRoot(Heap::k##rootName##RootIndex); \ | 45 return LoadRoot(Heap::k##rootName##RootIndex); \ |
| 46 } | 46 } |
| 47 HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR); | 47 HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR); |
| 48 #undef HEAP_CONSTANT_ACCESSOR | 48 #undef HEAP_CONSTANT_ACCESSOR |
| 49 | 49 |
| 50 #define HEAP_CONSTANT_TEST(rootName, name) \ | 50 #define HEAP_CONSTANT_TEST(rootName, name) \ |
| 51 Node* CodeStubAssembler::Is##name(Node* value) { \ | 51 Node* CodeStubAssembler::Is##name(Node* value) { \ |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 // If there's not enough space, call the runtime. | 604 // If there's not enough space, call the runtime. |
| 605 Variable result(this, MachineRepresentation::kTagged); | 605 Variable result(this, MachineRepresentation::kTagged); |
| 606 Label runtime_call(this, Label::kDeferred), no_runtime_call(this); | 606 Label runtime_call(this, Label::kDeferred), no_runtime_call(this); |
| 607 Label merge_runtime(this, &result); | 607 Label merge_runtime(this, &result); |
| 608 | 608 |
| 609 Node* new_top = IntPtrAdd(top, size_in_bytes); | 609 Node* new_top = IntPtrAdd(top, size_in_bytes); |
| 610 Branch(UintPtrGreaterThanOrEqual(new_top, limit), &runtime_call, | 610 Branch(UintPtrGreaterThanOrEqual(new_top, limit), &runtime_call, |
| 611 &no_runtime_call); | 611 &no_runtime_call); |
| 612 | 612 |
| 613 Bind(&runtime_call); | 613 Bind(&runtime_call); |
| 614 // AllocateInTargetSpace does not use the context. | |
| 615 Node* context = SmiConstant(Smi::kZero); | |
| 616 | |
| 617 Node* runtime_result; | 614 Node* runtime_result; |
| 618 if (flags & kPretenured) { | 615 if (flags & kPretenured) { |
| 619 Node* runtime_flags = SmiConstant( | 616 Node* runtime_flags = SmiConstant( |
| 620 Smi::FromInt(AllocateDoubleAlignFlag::encode(false) | | 617 Smi::FromInt(AllocateDoubleAlignFlag::encode(false) | |
| 621 AllocateTargetSpace::encode(AllocationSpace::OLD_SPACE))); | 618 AllocateTargetSpace::encode(AllocationSpace::OLD_SPACE))); |
| 622 runtime_result = CallRuntime(Runtime::kAllocateInTargetSpace, context, | 619 runtime_result = |
| 623 SmiTag(size_in_bytes), runtime_flags); | 620 CallRuntime(Runtime::kAllocateInTargetSpace, NoContextConstant(), |
| 621 SmiTag(size_in_bytes), runtime_flags); |
| 624 } else { | 622 } else { |
| 625 runtime_result = CallRuntime(Runtime::kAllocateInNewSpace, context, | 623 runtime_result = CallRuntime(Runtime::kAllocateInNewSpace, |
| 626 SmiTag(size_in_bytes)); | 624 NoContextConstant(), SmiTag(size_in_bytes)); |
| 627 } | 625 } |
| 628 result.Bind(runtime_result); | 626 result.Bind(runtime_result); |
| 629 Goto(&merge_runtime); | 627 Goto(&merge_runtime); |
| 630 | 628 |
| 631 // When there is enough space, return `top' and bump it up. | 629 // When there is enough space, return `top' and bump it up. |
| 632 Bind(&no_runtime_call); | 630 Bind(&no_runtime_call); |
| 633 Node* no_runtime_result = top; | 631 Node* no_runtime_result = top; |
| 634 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address, | 632 StoreNoWriteBarrier(MachineType::PointerRepresentation(), top_address, |
| 635 new_top); | 633 new_top); |
| 636 no_runtime_result = BitcastWordToTagged( | 634 no_runtime_result = BitcastWordToTagged( |
| (...skipping 6581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7218 result.Bind(CallRuntime(Runtime::kInstanceOf, context, object, callable)); | 7216 result.Bind(CallRuntime(Runtime::kInstanceOf, context, object, callable)); |
| 7219 Goto(&end); | 7217 Goto(&end); |
| 7220 } | 7218 } |
| 7221 | 7219 |
| 7222 Bind(&end); | 7220 Bind(&end); |
| 7223 return result.value(); | 7221 return result.value(); |
| 7224 } | 7222 } |
| 7225 | 7223 |
| 7226 } // namespace internal | 7224 } // namespace internal |
| 7227 } // namespace v8 | 7225 } // namespace v8 |
| OLD | NEW |