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

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

Issue 2396353002: Revert "Add Smi::Zero and replace all Smi::FromInt(0) calls" (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/builtins/x87/builtins-x87.cc ('k') | src/code-stubs.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 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
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() {
42 return SmiConstant(Smi::FromInt(0));
43 }
42 44
43 #define HEAP_CONSTANT_ACCESSOR(rootName, name) \ 45 #define HEAP_CONSTANT_ACCESSOR(rootName, name) \
44 Node* CodeStubAssembler::name##Constant() { \ 46 Node* CodeStubAssembler::name##Constant() { \
45 return LoadRoot(Heap::k##rootName##RootIndex); \ 47 return LoadRoot(Heap::k##rootName##RootIndex); \
46 } 48 }
47 HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR); 49 HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR);
48 #undef HEAP_CONSTANT_ACCESSOR 50 #undef HEAP_CONSTANT_ACCESSOR
49 51
50 #define HEAP_CONSTANT_TEST(rootName, name) \ 52 #define HEAP_CONSTANT_TEST(rootName, name) \
51 Node* CodeStubAssembler::Is##name(Node* value) { \ 53 Node* CodeStubAssembler::Is##name(Node* value) { \
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 Variable result(this, MachineRepresentation::kTagged); 607 Variable result(this, MachineRepresentation::kTagged);
606 Label runtime_call(this, Label::kDeferred), no_runtime_call(this); 608 Label runtime_call(this, Label::kDeferred), no_runtime_call(this);
607 Label merge_runtime(this, &result); 609 Label merge_runtime(this, &result);
608 610
609 Node* new_top = IntPtrAdd(top, size_in_bytes); 611 Node* new_top = IntPtrAdd(top, size_in_bytes);
610 Branch(UintPtrGreaterThanOrEqual(new_top, limit), &runtime_call, 612 Branch(UintPtrGreaterThanOrEqual(new_top, limit), &runtime_call,
611 &no_runtime_call); 613 &no_runtime_call);
612 614
613 Bind(&runtime_call); 615 Bind(&runtime_call);
614 // AllocateInTargetSpace does not use the context. 616 // AllocateInTargetSpace does not use the context.
615 Node* context = SmiConstant(Smi::kZero); 617 Node* context = SmiConstant(Smi::FromInt(0));
616 618
617 Node* runtime_result; 619 Node* runtime_result;
618 if (flags & kPretenured) { 620 if (flags & kPretenured) {
619 Node* runtime_flags = SmiConstant( 621 Node* runtime_flags = SmiConstant(
620 Smi::FromInt(AllocateDoubleAlignFlag::encode(false) | 622 Smi::FromInt(AllocateDoubleAlignFlag::encode(false) |
621 AllocateTargetSpace::encode(AllocationSpace::OLD_SPACE))); 623 AllocateTargetSpace::encode(AllocationSpace::OLD_SPACE)));
622 runtime_result = CallRuntime(Runtime::kAllocateInTargetSpace, context, 624 runtime_result = CallRuntime(Runtime::kAllocateInTargetSpace, context,
623 SmiTag(size_in_bytes), runtime_flags); 625 SmiTag(size_in_bytes), runtime_flags);
624 } else { 626 } else {
625 runtime_result = CallRuntime(Runtime::kAllocateInNewSpace, context, 627 runtime_result = CallRuntime(Runtime::kAllocateInNewSpace, context,
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 1670
1669 void CodeStubAssembler::CopyStringCharacters(compiler::Node* from_string, 1671 void CodeStubAssembler::CopyStringCharacters(compiler::Node* from_string,
1670 compiler::Node* to_string, 1672 compiler::Node* to_string,
1671 compiler::Node* from_index, 1673 compiler::Node* from_index,
1672 compiler::Node* character_count, 1674 compiler::Node* character_count,
1673 String::Encoding encoding) { 1675 String::Encoding encoding) {
1674 Label out(this); 1676 Label out(this);
1675 1677
1676 // Nothing to do for zero characters. 1678 // Nothing to do for zero characters.
1677 1679
1678 GotoIf(SmiLessThanOrEqual(character_count, SmiConstant(Smi::kZero)), &out); 1680 GotoIf(SmiLessThanOrEqual(character_count, SmiConstant(Smi::FromInt(0))),
1681 &out);
1679 1682
1680 // Calculate offsets into the strings. 1683 // Calculate offsets into the strings.
1681 1684
1682 Node* from_offset; 1685 Node* from_offset;
1683 Node* limit_offset; 1686 Node* limit_offset;
1684 Node* to_offset; 1687 Node* to_offset;
1685 1688
1686 { 1689 {
1687 Node* byte_count = SmiUntag(character_count); 1690 Node* byte_count = SmiUntag(character_count);
1688 Node* from_byte_index = SmiUntag(from_index); 1691 Node* from_byte_index = SmiUntag(from_index);
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 var_result.Bind(StringFromCharCode(char_code)); 2727 var_result.Bind(StringFromCharCode(char_code));
2725 Goto(&end); 2728 Goto(&end);
2726 } 2729 }
2727 2730
2728 Bind(&original_string_or_invalid_length); 2731 Bind(&original_string_or_invalid_length);
2729 { 2732 {
2730 // Longer than original string's length or negative: unsafe arguments. 2733 // Longer than original string's length or negative: unsafe arguments.
2731 GotoIf(SmiAbove(substr_length, string_length), &runtime); 2734 GotoIf(SmiAbove(substr_length, string_length), &runtime);
2732 2735
2733 // Equal length - check if {from, to} == {0, str.length}. 2736 // Equal length - check if {from, to} == {0, str.length}.
2734 GotoIf(SmiAbove(from, SmiConstant(Smi::kZero)), &runtime); 2737 GotoIf(SmiAbove(from, SmiConstant(Smi::FromInt(0))), &runtime);
2735 2738
2736 // Return the original string (substr_length == string_length). 2739 // Return the original string (substr_length == string_length).
2737 2740
2738 Counters* counters = isolate()->counters(); 2741 Counters* counters = isolate()->counters();
2739 IncrementCounter(counters->sub_string_native(), 1); 2742 IncrementCounter(counters->sub_string_native(), 1);
2740 2743
2741 var_result.Bind(string); 2744 var_result.Bind(string);
2742 Goto(&end); 2745 Goto(&end);
2743 } 2746 }
2744 2747
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
3045 3048
3046 Bind(&if_argisnotheapnumber); 3049 Bind(&if_argisnotheapnumber);
3047 { 3050 {
3048 // Need to convert {arg} to a Number first. 3051 // Need to convert {arg} to a Number first.
3049 Callable callable = CodeFactory::NonNumberToNumber(isolate()); 3052 Callable callable = CodeFactory::NonNumberToNumber(isolate());
3050 var_arg.Bind(CallStub(callable, context, arg)); 3053 var_arg.Bind(CallStub(callable, context, arg));
3051 Goto(&loop); 3054 Goto(&loop);
3052 } 3055 }
3053 3056
3054 Bind(&return_zero); 3057 Bind(&return_zero);
3055 var_arg.Bind(SmiConstant(Smi::kZero)); 3058 var_arg.Bind(SmiConstant(Smi::FromInt(0)));
3056 Goto(&out); 3059 Goto(&out);
3057 } 3060 }
3058 3061
3059 Bind(&out); 3062 Bind(&out);
3060 return var_arg.value(); 3063 return var_arg.value();
3061 } 3064 }
3062 3065
3063 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, 3066 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift,
3064 uint32_t mask) { 3067 uint32_t mask) {
3065 return Word32Shr(Word32And(word32, Int32Constant(mask)), 3068 return Word32Shr(Word32And(word32, Int32Constant(mask)),
(...skipping 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after
5637 BranchIfWordEqual(current_js_object.value(), NullConstant(), use_cache, 5640 BranchIfWordEqual(current_js_object.value(), NullConstant(), use_cache,
5638 &next); 5641 &next);
5639 } 5642 }
5640 } 5643 }
5641 5644
5642 Bind(&next); 5645 Bind(&next);
5643 { 5646 {
5644 // For all objects but the receiver, check that the cache is empty. 5647 // For all objects but the receiver, check that the cache is empty.
5645 current_map.Bind(LoadMap(current_js_object.value())); 5648 current_map.Bind(LoadMap(current_js_object.value()));
5646 Node* enum_length = EnumLength(current_map.value()); 5649 Node* enum_length = EnumLength(current_map.value());
5647 Node* zero_constant = SmiConstant(Smi::kZero); 5650 Node* zero_constant = SmiConstant(Smi::FromInt(0));
5648 BranchIf(WordEqual(enum_length, zero_constant), &loop, use_runtime); 5651 BranchIf(WordEqual(enum_length, zero_constant), &loop, use_runtime);
5649 } 5652 }
5650 } 5653 }
5651 5654
5652 Node* CodeStubAssembler::CreateAllocationSiteInFeedbackVector( 5655 Node* CodeStubAssembler::CreateAllocationSiteInFeedbackVector(
5653 Node* feedback_vector, Node* slot) { 5656 Node* feedback_vector, Node* slot) {
5654 Node* size = IntPtrConstant(AllocationSite::kSize); 5657 Node* size = IntPtrConstant(AllocationSite::kSize);
5655 Node* site = Allocate(size, CodeStubAssembler::kPretenured); 5658 Node* site = Allocate(size, CodeStubAssembler::kPretenured);
5656 5659
5657 // Store the map 5660 // Store the map
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
7139 result.Bind(CallRuntime(Runtime::kInstanceOf, context, object, callable)); 7142 result.Bind(CallRuntime(Runtime::kInstanceOf, context, object, callable));
7140 Goto(&end); 7143 Goto(&end);
7141 } 7144 }
7142 7145
7143 Bind(&end); 7146 Bind(&end);
7144 return result.value(); 7147 return result.value();
7145 } 7148 }
7146 7149
7147 } // namespace internal 7150 } // namespace internal
7148 } // namespace v8 7151 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/x87/builtins-x87.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698