Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/js-operator.h" | 5 #include "src/compiler/js-operator.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/base/lazy-instance.h" | 9 #include "src/base/lazy-instance.h" |
| 10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 size_t hash_value(VectorSlotPair const& p) { | 184 size_t hash_value(VectorSlotPair const& p) { |
| 185 // TODO(mvstanton): include the vector in the hash. | 185 // TODO(mvstanton): include the vector in the hash. |
| 186 base::hash<int> h; | 186 base::hash<int> h; |
| 187 return h(p.slot().ToInt()); | 187 return h(p.slot().ToInt()); |
| 188 } | 188 } |
| 189 | 189 |
| 190 | 190 |
| 191 bool operator==(LoadNamedParameters const& lhs, | 191 bool operator==(LoadNamedParameters const& lhs, |
| 192 LoadNamedParameters const& rhs) { | 192 LoadNamedParameters const& rhs) { |
| 193 return lhs.name() == rhs.name() && | 193 return lhs.name() == rhs.name() && |
| 194 lhs.contextual_mode() == rhs.contextual_mode() && | 194 lhs.contextual_mode() == rhs.contextual_mode() && |
|
Michael Starzinger
2015/06/09 10:54:13
This operator should be adapted as well.
conradw
2015/06/09 11:20:30
Done.
| |
| 195 lhs.feedback() == rhs.feedback(); | 195 lhs.feedback() == rhs.feedback(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 | 198 |
| 199 bool operator!=(LoadNamedParameters const& lhs, | 199 bool operator!=(LoadNamedParameters const& lhs, |
| 200 LoadNamedParameters const& rhs) { | 200 LoadNamedParameters const& rhs) { |
| 201 return !(lhs == rhs); | 201 return !(lhs == rhs); |
| 202 } | 202 } |
| 203 | 203 |
| 204 | 204 |
| 205 size_t hash_value(LoadNamedParameters const& p) { | 205 size_t hash_value(LoadNamedParameters const& p) { |
| 206 return base::hash_combine(p.name(), p.contextual_mode(), p.feedback()); | 206 return base::hash_combine(p.name(), p.contextual_mode(), p.feedback()); |
|
Michael Starzinger
2015/06/09 10:54:13
This operator should be adapted as well.
conradw
2015/06/09 11:20:30
Done.
| |
| 207 } | 207 } |
| 208 | 208 |
| 209 | 209 |
| 210 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) { | 210 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) { |
| 211 return os << Brief(*p.name().handle()) << ", " << p.contextual_mode(); | 211 return os << Brief(*p.name().handle()) << ", " << p.contextual_mode(); |
|
Michael Starzinger
2015/06/09 10:54:13
This operator should be adapted as well.
conradw
2015/06/09 11:20:30
Done.
| |
| 212 } | 212 } |
| 213 | 213 |
| 214 | 214 |
| 215 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) { | 215 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) { |
| 216 // Nothing special to print. | 216 // Nothing special to print. |
|
Michael Starzinger
2015/06/09 10:54:13
This operator should be adapted as well.
conradw
2015/06/09 11:20:30
Done.
| |
| 217 return os; | 217 return os; |
| 218 } | 218 } |
| 219 | 219 |
| 220 | 220 |
| 221 bool operator==(LoadPropertyParameters const& lhs, | 221 bool operator==(LoadPropertyParameters const& lhs, |
| 222 LoadPropertyParameters const& rhs) { | 222 LoadPropertyParameters const& rhs) { |
| 223 return lhs.feedback() == rhs.feedback(); | 223 return lhs.feedback() == rhs.feedback(); |
|
Michael Starzinger
2015/06/09 10:54:13
This operator should be adapted as well.
conradw
2015/06/09 11:20:30
Done.
| |
| 224 } | 224 } |
| 225 | 225 |
| 226 | 226 |
| 227 bool operator!=(LoadPropertyParameters const& lhs, | 227 bool operator!=(LoadPropertyParameters const& lhs, |
| 228 LoadPropertyParameters const& rhs) { | 228 LoadPropertyParameters const& rhs) { |
| 229 return !(lhs == rhs); | 229 return !(lhs == rhs); |
| 230 } | 230 } |
| 231 | 231 |
| 232 | 232 |
| 233 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op) { | 233 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op) { |
| 234 DCHECK_EQ(IrOpcode::kJSLoadProperty, op->opcode()); | 234 DCHECK_EQ(IrOpcode::kJSLoadProperty, op->opcode()); |
| 235 return OpParameter<LoadPropertyParameters>(op); | 235 return OpParameter<LoadPropertyParameters>(op); |
| 236 } | 236 } |
| 237 | 237 |
| 238 | 238 |
| 239 size_t hash_value(LoadPropertyParameters const& p) { | 239 size_t hash_value(LoadPropertyParameters const& p) { |
| 240 return hash_value(p.feedback()); | 240 return hash_value(p.feedback()); |
|
Michael Starzinger
2015/06/09 10:54:13
This operator should be adapted as well.
conradw
2015/06/09 11:20:30
Done.
| |
| 241 } | 241 } |
| 242 | 242 |
| 243 | 243 |
| 244 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) { | 244 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) { |
| 245 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); | 245 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); |
| 246 return OpParameter<LoadNamedParameters>(op); | 246 return OpParameter<LoadNamedParameters>(op); |
| 247 } | 247 } |
| 248 | 248 |
| 249 | 249 |
| 250 bool operator==(StoreNamedParameters const& lhs, | 250 bool operator==(StoreNamedParameters const& lhs, |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 453 return new (zone()) Operator1<int>( // -- | 453 return new (zone()) Operator1<int>( // -- |
| 454 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode | 454 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode |
| 455 "JSCallConstruct", // name | 455 "JSCallConstruct", // name |
| 456 arguments, 1, 1, 1, 1, 2, // counts | 456 arguments, 1, 1, 1, 1, 2, // counts |
| 457 arguments); // parameter | 457 arguments); // parameter |
| 458 } | 458 } |
| 459 | 459 |
| 460 | 460 |
| 461 const Operator* JSOperatorBuilder::LoadNamed(const Unique<Name>& name, | 461 const Operator* JSOperatorBuilder::LoadNamed(const Unique<Name>& name, |
| 462 const VectorSlotPair& feedback, | 462 const VectorSlotPair& feedback, |
| 463 LanguageMode language_mode, | |
| 463 ContextualMode contextual_mode) { | 464 ContextualMode contextual_mode) { |
| 464 LoadNamedParameters parameters(name, feedback, contextual_mode); | 465 LoadNamedParameters parameters(name, feedback, language_mode, |
| 466 contextual_mode); | |
| 465 return new (zone()) Operator1<LoadNamedParameters>( // -- | 467 return new (zone()) Operator1<LoadNamedParameters>( // -- |
| 466 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode | 468 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode |
| 467 "JSLoadNamed", // name | 469 "JSLoadNamed", // name |
| 468 1, 1, 1, 1, 1, 2, // counts | 470 1, 1, 1, 1, 1, 2, // counts |
| 469 parameters); // parameter | 471 parameters); // parameter |
| 470 } | 472 } |
| 471 | 473 |
| 472 | 474 |
| 473 const Operator* JSOperatorBuilder::LoadProperty( | 475 const Operator* JSOperatorBuilder::LoadProperty(const VectorSlotPair& feedback, |
| 474 const VectorSlotPair& feedback) { | 476 LanguageMode language_mode) { |
| 475 LoadPropertyParameters parameters(feedback); | 477 LoadPropertyParameters parameters(feedback, language_mode); |
| 476 return new (zone()) Operator1<LoadPropertyParameters>( // -- | 478 return new (zone()) Operator1<LoadPropertyParameters>( // -- |
| 477 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode | 479 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode |
| 478 "JSLoadProperty", // name | 480 "JSLoadProperty", // name |
| 479 2, 1, 1, 1, 1, 2, // counts | 481 2, 1, 1, 1, 1, 2, // counts |
| 480 parameters); // parameter | 482 parameters); // parameter |
| 481 } | 483 } |
| 482 | 484 |
| 483 | 485 |
| 484 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode, | 486 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode, |
| 485 const Unique<Name>& name) { | 487 const Unique<Name>& name) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 583 return new (zone()) Operator1<Unique<String>>( // -- | 585 return new (zone()) Operator1<Unique<String>>( // -- |
| 584 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode | 586 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode |
| 585 "JSCreateCatchContext", // name | 587 "JSCreateCatchContext", // name |
| 586 2, 1, 1, 1, 1, 2, // counts | 588 2, 1, 1, 1, 1, 2, // counts |
| 587 name); // parameter | 589 name); // parameter |
| 588 } | 590 } |
| 589 | 591 |
| 590 } // namespace compiler | 592 } // namespace compiler |
| 591 } // namespace internal | 593 } // namespace internal |
| 592 } // namespace v8 | 594 } // namespace v8 |
| OLD | NEW |