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

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

Issue 1475823003: [runtime] First step to sanitize regexp literal creation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ 5 #ifndef V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_
6 #define V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ 6 #define V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_
7 7
8 #include <cstring> 8 #include <cstring>
9 #include <iosfwd> 9 #include <iosfwd>
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 V(MathFloorOfDiv) \ 123 V(MathFloorOfDiv) \
124 V(MathMinMax) \ 124 V(MathMinMax) \
125 V(MaybeGrowElements) \ 125 V(MaybeGrowElements) \
126 V(Mod) \ 126 V(Mod) \
127 V(Mul) \ 127 V(Mul) \
128 V(OsrEntry) \ 128 V(OsrEntry) \
129 V(Parameter) \ 129 V(Parameter) \
130 V(Power) \ 130 V(Power) \
131 V(Prologue) \ 131 V(Prologue) \
132 V(PushArguments) \ 132 V(PushArguments) \
133 V(RegExpLiteral) \
134 V(Return) \ 133 V(Return) \
135 V(Ror) \ 134 V(Ror) \
136 V(Sar) \ 135 V(Sar) \
137 V(SeqStringGetChar) \ 136 V(SeqStringGetChar) \
138 V(SeqStringSetChar) \ 137 V(SeqStringSetChar) \
139 V(Shl) \ 138 V(Shl) \
140 V(Shr) \ 139 V(Shr) \
141 V(Simulate) \ 140 V(Simulate) \
142 V(StackCheck) \ 141 V(StackCheck) \
143 V(StoreCodeEntry) \ 142 V(StoreCodeEntry) \
(...skipping 7251 matching lines...) Expand 10 before | Expand all | Expand 10 after
7395 SetFlag(kUseGVN); 7394 SetFlag(kUseGVN);
7396 SetChangesFlag(kNewSpacePromotion); 7395 SetChangesFlag(kNewSpacePromotion);
7397 } 7396 }
7398 7397
7399 bool IsDeletable() const override { 7398 bool IsDeletable() const override {
7400 return !value()->ToNumberCanBeObserved(); 7399 return !value()->ToNumberCanBeObserved();
7401 } 7400 }
7402 }; 7401 };
7403 7402
7404 7403
7405 template <int V>
7406 class HMaterializedLiteral : public HTemplateInstruction<V> {
7407 public:
7408 HMaterializedLiteral<V>(int index, int depth, AllocationSiteMode mode)
7409 : literal_index_(index), depth_(depth), allocation_site_mode_(mode) {
7410 this->set_representation(Representation::Tagged());
7411 }
7412
7413 HMaterializedLiteral<V>(int index, int depth)
7414 : literal_index_(index), depth_(depth),
7415 allocation_site_mode_(DONT_TRACK_ALLOCATION_SITE) {
7416 this->set_representation(Representation::Tagged());
7417 }
7418
7419 int literal_index() const { return literal_index_; }
7420 int depth() const { return depth_; }
7421 AllocationSiteMode allocation_site_mode() const {
7422 return allocation_site_mode_;
7423 }
7424
7425 private:
7426 bool IsDeletable() const final { return true; }
7427
7428 int literal_index_;
7429 int depth_;
7430 AllocationSiteMode allocation_site_mode_;
7431 };
7432
7433
7434 class HRegExpLiteral final : public HMaterializedLiteral<1> {
7435 public:
7436 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HRegExpLiteral,
7437 Handle<FixedArray>,
7438 Handle<String>,
7439 Handle<String>,
7440 int);
7441
7442 HValue* context() { return OperandAt(0); }
7443 Handle<FixedArray> literals() { return literals_; }
7444 Handle<String> pattern() { return pattern_; }
7445 Handle<String> flags() { return flags_; }
7446
7447 Representation RequiredInputRepresentation(int index) override {
7448 return Representation::Tagged();
7449 }
7450
7451 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral)
7452
7453 private:
7454 HRegExpLiteral(HValue* context,
7455 Handle<FixedArray> literals,
7456 Handle<String> pattern,
7457 Handle<String> flags,
7458 int literal_index)
7459 : HMaterializedLiteral<1>(literal_index, 0),
7460 literals_(literals),
7461 pattern_(pattern),
7462 flags_(flags) {
7463 SetOperandAt(0, context);
7464 SetAllSideEffects();
7465 set_type(HType::JSObject());
7466 }
7467
7468 Handle<FixedArray> literals_;
7469 Handle<String> pattern_;
7470 Handle<String> flags_;
7471 };
7472
7473
7474 class HTypeof final : public HTemplateInstruction<2> { 7404 class HTypeof final : public HTemplateInstruction<2> {
7475 public: 7405 public:
7476 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*); 7406 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*);
7477 7407
7478 HValue* context() const { return OperandAt(0); } 7408 HValue* context() const { return OperandAt(0); }
7479 HValue* value() const { return OperandAt(1); } 7409 HValue* value() const { return OperandAt(1); }
7480 7410
7481 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT 7411 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT
7482 7412
7483 Representation RequiredInputRepresentation(int index) override { 7413 Representation RequiredInputRepresentation(int index) override {
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
7897 7827
7898 7828
7899 7829
7900 #undef DECLARE_INSTRUCTION 7830 #undef DECLARE_INSTRUCTION
7901 #undef DECLARE_CONCRETE_INSTRUCTION 7831 #undef DECLARE_CONCRETE_INSTRUCTION
7902 7832
7903 } // namespace internal 7833 } // namespace internal
7904 } // namespace v8 7834 } // namespace v8
7905 7835
7906 #endif // V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ 7836 #endif // V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698