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

Side by Side Diff: src/builtins/builtins-string.cc

Issue 2608433003: [csa] Re-introduce automatic constant folding for IntPtrAdd and IntPtrSub (Closed)
Patch Set: Review feedback Created 3 years, 11 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 | « no previous file | src/code-stub-assembler.h » ('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/builtins/builtins-utils.h" 5 #include "src/builtins/builtins-utils.h"
6 #include "src/builtins/builtins.h" 6 #include "src/builtins/builtins.h"
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stub-assembler.h" 8 #include "src/code-stub-assembler.h"
9 #include "src/regexp/regexp-utils.h" 9 #include "src/regexp/regexp-utils.h"
10 10
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 Node* OneByteCharOffset(Node* index) { 32 Node* OneByteCharOffset(Node* index) {
33 return CharOffset(String::ONE_BYTE_ENCODING, index); 33 return CharOffset(String::ONE_BYTE_ENCODING, index);
34 } 34 }
35 35
36 Node* CharOffset(String::Encoding encoding, Node* index) { 36 Node* CharOffset(String::Encoding encoding, Node* index) {
37 const int header = SeqOneByteString::kHeaderSize - kHeapObjectTag; 37 const int header = SeqOneByteString::kHeaderSize - kHeapObjectTag;
38 Node* offset = index; 38 Node* offset = index;
39 if (encoding == String::TWO_BYTE_ENCODING) { 39 if (encoding == String::TWO_BYTE_ENCODING) {
40 offset = IntPtrAddFoldConstants(offset, offset); 40 offset = IntPtrAdd(offset, offset);
41 } 41 }
42 offset = IntPtrAddFoldConstants(offset, IntPtrConstant(header)); 42 offset = IntPtrAdd(offset, IntPtrConstant(header));
43 return offset; 43 return offset;
44 } 44 }
45 45
46 void BranchIfSimpleOneByteStringInstanceType(Node* instance_type, 46 void BranchIfSimpleOneByteStringInstanceType(Node* instance_type,
47 Label* if_true, 47 Label* if_true,
48 Label* if_false) { 48 Label* if_false) {
49 const int kMask = kStringRepresentationMask | kStringEncodingMask; 49 const int kMask = kStringRepresentationMask | kStringEncodingMask;
50 const int kType = kOneByteStringTag | kSeqStringTag; 50 const int kType = kOneByteStringTag | kSeqStringTag;
51 Branch(Word32Equal(Word32And(instance_type, Int32Constant(kMask)), 51 Branch(Word32Equal(Word32And(instance_type, Int32Constant(kMask)),
52 Int32Constant(kType)), 52 Int32Constant(kType)),
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 Runtime::kThrowIncompatibleMethodReceiver, context, 1649 Runtime::kThrowIncompatibleMethodReceiver, context,
1650 assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked( 1650 assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked(
1651 "String Iterator.prototype.next", TENURED)), 1651 "String Iterator.prototype.next", TENURED)),
1652 iterator); 1652 iterator);
1653 assembler.Return(result); // Never reached. 1653 assembler.Return(result); // Never reached.
1654 } 1654 }
1655 } 1655 }
1656 1656
1657 } // namespace internal 1657 } // namespace internal
1658 } // namespace v8 1658 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698