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

Side by Side Diff: src/hydrogen-instructions.h

Issue 63863005: Add new HSeqStringGetChar instruction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix invalid use of movw(). Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 V(OsrEntry) \ 152 V(OsrEntry) \
153 V(OuterContext) \ 153 V(OuterContext) \
154 V(Parameter) \ 154 V(Parameter) \
155 V(Power) \ 155 V(Power) \
156 V(PushArgument) \ 156 V(PushArgument) \
157 V(Random) \ 157 V(Random) \
158 V(RegExpLiteral) \ 158 V(RegExpLiteral) \
159 V(Return) \ 159 V(Return) \
160 V(Ror) \ 160 V(Ror) \
161 V(Sar) \ 161 V(Sar) \
162 V(SeqStringGetChar) \
162 V(SeqStringSetChar) \ 163 V(SeqStringSetChar) \
163 V(Shl) \ 164 V(Shl) \
164 V(Shr) \ 165 V(Shr) \
165 V(Simulate) \ 166 V(Simulate) \
166 V(StackCheck) \ 167 V(StackCheck) \
167 V(StoreCodeEntry) \ 168 V(StoreCodeEntry) \
168 V(StoreContextSlot) \ 169 V(StoreContextSlot) \
169 V(StoreGlobalCell) \ 170 V(StoreGlobalCell) \
170 V(StoreGlobalGeneric) \ 171 V(StoreGlobalGeneric) \
171 V(StoreKeyed) \ 172 V(StoreKeyed) \
(...skipping 6844 matching lines...) Expand 10 before | Expand all | Expand 10 after
7016 private: 7017 private:
7017 HDateField(HValue* date, Smi* index) 7018 HDateField(HValue* date, Smi* index)
7018 : HUnaryOperation(date), index_(index) { 7019 : HUnaryOperation(date), index_(index) {
7019 set_representation(Representation::Tagged()); 7020 set_representation(Representation::Tagged());
7020 } 7021 }
7021 7022
7022 Smi* index_; 7023 Smi* index_;
7023 }; 7024 };
7024 7025
7025 7026
7027 class HSeqStringGetChar V8_FINAL : public HTemplateInstruction<2> {
7028 public:
7029 static HInstruction* New(Zone* zone,
7030 HValue* context,
7031 String::Encoding encoding,
7032 HValue* string,
7033 HValue* index);
7034
7035 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7036 return (index == 0) ? Representation::Tagged()
7037 : Representation::Integer32();
7038 }
7039
7040 String::Encoding encoding() const { return encoding_; }
7041 HValue* string() const { return OperandAt(0); }
7042 HValue* index() const { return OperandAt(1); }
7043
7044 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar)
7045
7046 protected:
7047 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
7048 return encoding() == HSeqStringGetChar::cast(other)->encoding();
7049 }
7050
7051 virtual Range* InferRange(Zone* zone) V8_OVERRIDE {
7052 if (encoding() == String::ONE_BYTE_ENCODING) {
7053 return new(zone) Range(0, String::kMaxOneByteCharCode);
7054 } else {
7055 ASSERT_EQ(String::TWO_BYTE_ENCODING, encoding());
7056 return new(zone) Range(0, String::kMaxUtf16CodeUnit);
7057 }
7058 }
7059
7060 private:
7061 HSeqStringGetChar(String::Encoding encoding,
7062 HValue* string,
7063 HValue* index) : encoding_(encoding) {
7064 SetOperandAt(0, string);
7065 SetOperandAt(1, index);
7066 set_representation(Representation::Integer32());
7067 SetFlag(kUseGVN);
7068 SetGVNFlag(kDependsOnStringChars);
7069 }
7070
7071 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7072
7073 String::Encoding encoding_;
7074 };
7075
7076
7026 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> { 7077 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> {
7027 public: 7078 public:
7028 DECLARE_INSTRUCTION_FACTORY_P4(HSeqStringSetChar, String::Encoding, 7079 DECLARE_INSTRUCTION_FACTORY_P4(HSeqStringSetChar, String::Encoding,
7029 HValue*, HValue*, HValue*); 7080 HValue*, HValue*, HValue*);
7030 7081
7031 String::Encoding encoding() { return encoding_; } 7082 String::Encoding encoding() { return encoding_; }
7032 HValue* string() { return OperandAt(0); } 7083 HValue* string() { return OperandAt(0); }
7033 HValue* index() { return OperandAt(1); } 7084 HValue* index() { return OperandAt(1); }
7034 HValue* value() { return OperandAt(2); } 7085 HValue* value() { return OperandAt(2); }
7035 7086
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
7193 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7244 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7194 }; 7245 };
7195 7246
7196 7247
7197 #undef DECLARE_INSTRUCTION 7248 #undef DECLARE_INSTRUCTION
7198 #undef DECLARE_CONCRETE_INSTRUCTION 7249 #undef DECLARE_CONCRETE_INSTRUCTION
7199 7250
7200 } } // namespace v8::internal 7251 } } // namespace v8::internal
7201 7252
7202 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7253 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698