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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 struct Name##Operator FINAL : public Operator { \ | 252 struct Name##Operator FINAL : public Operator { \ |
253 Name##Operator() \ | 253 Name##Operator() \ |
254 : Operator(IrOpcode::kJS##Name, properties, "JS" #Name, \ | 254 : Operator(IrOpcode::kJS##Name, properties, "JS" #Name, \ |
255 value_input_count, Operator::ZeroIfPure(properties), \ | 255 value_input_count, Operator::ZeroIfPure(properties), \ |
256 Operator::ZeroIfPure(properties), value_output_count, \ | 256 Operator::ZeroIfPure(properties), value_output_count, \ |
257 Operator::ZeroIfPure(properties), 0) {} \ | 257 Operator::ZeroIfPure(properties), 0) {} \ |
258 }; \ | 258 }; \ |
259 Name##Operator k##Name##Operator; | 259 Name##Operator k##Name##Operator; |
260 CACHED_OP_LIST(CACHED) | 260 CACHED_OP_LIST(CACHED) |
261 #undef CACHED | 261 #undef CACHED |
| 262 |
| 263 template <StrictMode kStrictMode> |
| 264 struct StorePropertyOperator FINAL : public Operator1<StrictMode> { |
| 265 StorePropertyOperator() |
| 266 : Operator1<StrictMode>(IrOpcode::kJSStoreProperty, |
| 267 Operator::kNoProperties, "JSStoreProperty", 3, |
| 268 1, 1, 0, 1, 0, kStrictMode) {} |
| 269 }; |
| 270 StorePropertyOperator<SLOPPY> kStorePropertySloppyOperator; |
| 271 StorePropertyOperator<STRICT> kStorePropertyStrictOperator; |
262 }; | 272 }; |
263 | 273 |
264 | 274 |
265 static base::LazyInstance<JSOperatorGlobalCache>::type kCache = | 275 static base::LazyInstance<JSOperatorGlobalCache>::type kCache = |
266 LAZY_INSTANCE_INITIALIZER; | 276 LAZY_INSTANCE_INITIALIZER; |
267 | 277 |
268 | 278 |
269 JSOperatorBuilder::JSOperatorBuilder(Zone* zone) | 279 JSOperatorBuilder::JSOperatorBuilder(Zone* zone) |
270 : cache_(kCache.Get()), zone_(zone) {} | 280 : cache_(kCache.Get()), zone_(zone) {} |
271 | 281 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 LoadPropertyParameters parameters(feedback); | 338 LoadPropertyParameters parameters(feedback); |
329 return new (zone()) Operator1<LoadPropertyParameters>( // -- | 339 return new (zone()) Operator1<LoadPropertyParameters>( // -- |
330 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode | 340 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode |
331 "JSLoadProperty", // name | 341 "JSLoadProperty", // name |
332 2, 1, 1, 1, 1, 0, // counts | 342 2, 1, 1, 1, 1, 0, // counts |
333 parameters); // parameter | 343 parameters); // parameter |
334 } | 344 } |
335 | 345 |
336 | 346 |
337 const Operator* JSOperatorBuilder::StoreProperty(StrictMode strict_mode) { | 347 const Operator* JSOperatorBuilder::StoreProperty(StrictMode strict_mode) { |
338 return new (zone()) Operator1<StrictMode>( // -- | 348 switch (strict_mode) { |
339 IrOpcode::kJSStoreProperty, Operator::kNoProperties, // opcode | 349 case SLOPPY: |
340 "JSStoreProperty", // name | 350 return &cache_.kStorePropertySloppyOperator; |
341 3, 1, 1, 0, 1, 0, // counts | 351 case STRICT: |
342 strict_mode); // parameter | 352 return &cache_.kStorePropertyStrictOperator; |
| 353 } |
| 354 UNREACHABLE(); |
| 355 return nullptr; |
343 } | 356 } |
344 | 357 |
345 | 358 |
346 const Operator* JSOperatorBuilder::StoreNamed(StrictMode strict_mode, | 359 const Operator* JSOperatorBuilder::StoreNamed(StrictMode strict_mode, |
347 const Unique<Name>& name) { | 360 const Unique<Name>& name) { |
348 StoreNamedParameters parameters(strict_mode, name); | 361 StoreNamedParameters parameters(strict_mode, name); |
349 return new (zone()) Operator1<StoreNamedParameters>( // -- | 362 return new (zone()) Operator1<StoreNamedParameters>( // -- |
350 IrOpcode::kJSStoreNamed, Operator::kNoProperties, // opcode | 363 IrOpcode::kJSStoreNamed, Operator::kNoProperties, // opcode |
351 "JSStoreNamed", // name | 364 "JSStoreNamed", // name |
352 2, 1, 1, 0, 1, 0, // counts | 365 2, 1, 1, 0, 1, 0, // counts |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 return new (zone()) Operator1<Unique<String>>( // -- | 402 return new (zone()) Operator1<Unique<String>>( // -- |
390 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode | 403 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode |
391 "JSCreateCatchContext", // name | 404 "JSCreateCatchContext", // name |
392 1, 1, 1, 1, 1, 0, // counts | 405 1, 1, 1, 1, 1, 0, // counts |
393 name); // parameter | 406 name); // parameter |
394 } | 407 } |
395 | 408 |
396 } // namespace compiler | 409 } // namespace compiler |
397 } // namespace internal | 410 } // namespace internal |
398 } // namespace v8 | 411 } // namespace v8 |
OLD | NEW |