OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_COMPILER_JS_OPERATOR_H_ | 5 #ifndef V8_COMPILER_JS_OPERATOR_H_ |
6 #define V8_COMPILER_JS_OPERATOR_H_ | 6 #define V8_COMPILER_JS_OPERATOR_H_ |
7 | 7 |
8 #include "src/runtime/runtime.h" | 8 #include "src/runtime/runtime.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 | 48 |
49 // Defines whether tail call optimization is allowed. | 49 // Defines whether tail call optimization is allowed. |
50 enum class TailCallMode : unsigned { kAllow, kDisallow }; | 50 enum class TailCallMode : unsigned { kAllow, kDisallow }; |
51 | 51 |
52 size_t hash_value(TailCallMode); | 52 size_t hash_value(TailCallMode); |
53 | 53 |
54 std::ostream& operator<<(std::ostream&, TailCallMode); | 54 std::ostream& operator<<(std::ostream&, TailCallMode); |
55 | 55 |
56 | 56 |
| 57 // Defines the arity and the feedback for a JavaScript constructor call. This is |
| 58 // used as a parameter by JSCallConstruct operators. |
| 59 class CallConstructParameters final { |
| 60 public: |
| 61 CallConstructParameters(size_t arity, VectorSlotPair const& feedback) |
| 62 : arity_(arity), feedback_(feedback) {} |
| 63 |
| 64 size_t arity() const { return arity_; } |
| 65 VectorSlotPair const& feedback() const { return feedback_; } |
| 66 |
| 67 private: |
| 68 size_t const arity_; |
| 69 VectorSlotPair const feedback_; |
| 70 }; |
| 71 |
| 72 bool operator==(CallConstructParameters const&, CallConstructParameters const&); |
| 73 bool operator!=(CallConstructParameters const&, CallConstructParameters const&); |
| 74 |
| 75 size_t hash_value(CallConstructParameters const&); |
| 76 |
| 77 std::ostream& operator<<(std::ostream&, CallConstructParameters const&); |
| 78 |
| 79 CallConstructParameters const& CallConstructParametersOf(Operator const*); |
| 80 |
| 81 |
57 // Defines the arity and the call flags for a JavaScript function call. This is | 82 // Defines the arity and the call flags for a JavaScript function call. This is |
58 // used as a parameter by JSCallFunction operators. | 83 // used as a parameter by JSCallFunction operators. |
59 class CallFunctionParameters final { | 84 class CallFunctionParameters final { |
60 public: | 85 public: |
61 CallFunctionParameters(size_t arity, LanguageMode language_mode, | 86 CallFunctionParameters(size_t arity, LanguageMode language_mode, |
62 VectorSlotPair const& feedback, | 87 VectorSlotPair const& feedback, |
63 TailCallMode tail_call_mode, | 88 TailCallMode tail_call_mode, |
64 ConvertReceiverMode convert_mode) | 89 ConvertReceiverMode convert_mode) |
65 : bit_field_(ArityField::encode(arity) | | 90 : bit_field_(ArityField::encode(arity) | |
66 ConvertReceiverModeField::encode(convert_mode) | | 91 ConvertReceiverModeField::encode(convert_mode) | |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 CreateArgumentsParameters const&); | 345 CreateArgumentsParameters const&); |
321 | 346 |
322 size_t hash_value(CreateArgumentsParameters const&); | 347 size_t hash_value(CreateArgumentsParameters const&); |
323 | 348 |
324 std::ostream& operator<<(std::ostream&, CreateArgumentsParameters const&); | 349 std::ostream& operator<<(std::ostream&, CreateArgumentsParameters const&); |
325 | 350 |
326 const CreateArgumentsParameters& CreateArgumentsParametersOf( | 351 const CreateArgumentsParameters& CreateArgumentsParametersOf( |
327 const Operator* op); | 352 const Operator* op); |
328 | 353 |
329 | 354 |
| 355 // Defines shared information for the array that should be created. This is |
| 356 // used as parameter by JSCreateArray operators. |
| 357 class CreateArrayParameters final { |
| 358 public: |
| 359 explicit CreateArrayParameters(size_t arity, Handle<AllocationSite> site) |
| 360 : arity_(arity), site_(site) {} |
| 361 |
| 362 size_t arity() const { return arity_; } |
| 363 Handle<AllocationSite> site() const { return site_; } |
| 364 |
| 365 private: |
| 366 size_t const arity_; |
| 367 Handle<AllocationSite> const site_; |
| 368 }; |
| 369 |
| 370 bool operator==(CreateArrayParameters const&, CreateArrayParameters const&); |
| 371 bool operator!=(CreateArrayParameters const&, CreateArrayParameters const&); |
| 372 |
| 373 size_t hash_value(CreateArrayParameters const&); |
| 374 |
| 375 std::ostream& operator<<(std::ostream&, CreateArrayParameters const&); |
| 376 |
| 377 const CreateArrayParameters& CreateArrayParametersOf(const Operator* op); |
| 378 |
| 379 |
330 // Defines shared information for the closure that should be created. This is | 380 // Defines shared information for the closure that should be created. This is |
331 // used as a parameter by JSCreateClosure operators. | 381 // used as a parameter by JSCreateClosure operators. |
332 class CreateClosureParameters final { | 382 class CreateClosureParameters final { |
333 public: | 383 public: |
334 CreateClosureParameters(Handle<SharedFunctionInfo> shared_info, | 384 CreateClosureParameters(Handle<SharedFunctionInfo> shared_info, |
335 PretenureFlag pretenure) | 385 PretenureFlag pretenure) |
336 : shared_info_(shared_info), pretenure_(pretenure) {} | 386 : shared_info_(shared_info), pretenure_(pretenure) {} |
337 | 387 |
338 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 388 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
339 PretenureFlag pretenure() const { return pretenure_; } | 389 PretenureFlag pretenure() const { return pretenure_; } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 const Operator* ToBoolean(); | 434 const Operator* ToBoolean(); |
385 const Operator* ToNumber(); | 435 const Operator* ToNumber(); |
386 const Operator* ToString(); | 436 const Operator* ToString(); |
387 const Operator* ToName(); | 437 const Operator* ToName(); |
388 const Operator* ToObject(); | 438 const Operator* ToObject(); |
389 const Operator* Yield(); | 439 const Operator* Yield(); |
390 | 440 |
391 const Operator* Create(); | 441 const Operator* Create(); |
392 const Operator* CreateArguments(CreateArgumentsParameters::Type type, | 442 const Operator* CreateArguments(CreateArgumentsParameters::Type type, |
393 int start_index); | 443 int start_index); |
| 444 const Operator* CreateArray(size_t arity, Handle<AllocationSite> site); |
394 const Operator* CreateClosure(Handle<SharedFunctionInfo> shared_info, | 445 const Operator* CreateClosure(Handle<SharedFunctionInfo> shared_info, |
395 PretenureFlag pretenure); | 446 PretenureFlag pretenure); |
396 const Operator* CreateLiteralArray(int literal_flags); | 447 const Operator* CreateLiteralArray(int literal_flags); |
397 const Operator* CreateLiteralObject(int literal_flags); | 448 const Operator* CreateLiteralObject(int literal_flags); |
398 | 449 |
399 const Operator* CallFunction( | 450 const Operator* CallFunction( |
400 size_t arity, LanguageMode language_mode, | 451 size_t arity, LanguageMode language_mode, |
401 VectorSlotPair const& feedback = VectorSlotPair(), | 452 VectorSlotPair const& feedback = VectorSlotPair(), |
402 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, | 453 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, |
403 TailCallMode tail_call_mode = TailCallMode::kDisallow); | 454 TailCallMode tail_call_mode = TailCallMode::kDisallow); |
404 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); | 455 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); |
405 const Operator* CallConstruct(int arguments); | 456 const Operator* CallConstruct(size_t arity, VectorSlotPair const& feedback); |
406 | 457 |
407 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); | 458 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); |
408 | 459 |
409 const Operator* LoadProperty(LanguageMode language_mode, | 460 const Operator* LoadProperty(LanguageMode language_mode, |
410 VectorSlotPair const& feedback); | 461 VectorSlotPair const& feedback); |
411 const Operator* LoadNamed(LanguageMode language_mode, Handle<Name> name, | 462 const Operator* LoadNamed(LanguageMode language_mode, Handle<Name> name, |
412 VectorSlotPair const& feedback); | 463 VectorSlotPair const& feedback); |
413 | 464 |
414 const Operator* StoreProperty(LanguageMode language_mode, | 465 const Operator* StoreProperty(LanguageMode language_mode, |
415 VectorSlotPair const& feedback); | 466 VectorSlotPair const& feedback); |
416 const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name, | 467 const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name, |
417 VectorSlotPair const& feedback); | 468 VectorSlotPair const& feedback); |
418 | 469 |
419 const Operator* DeleteProperty(LanguageMode language_mode); | 470 const Operator* DeleteProperty(LanguageMode language_mode); |
420 | 471 |
421 const Operator* HasProperty(); | 472 const Operator* HasProperty(); |
422 | 473 |
423 const Operator* LoadGlobal(const Handle<Name>& name, | 474 const Operator* LoadGlobal(const Handle<Name>& name, |
424 const VectorSlotPair& feedback, | 475 const VectorSlotPair& feedback, |
425 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); | 476 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); |
426 const Operator* StoreGlobal(LanguageMode language_mode, | 477 const Operator* StoreGlobal(LanguageMode language_mode, |
427 const Handle<Name>& name, | 478 const Handle<Name>& name, |
428 const VectorSlotPair& feedback); | 479 const VectorSlotPair& feedback); |
429 | 480 |
430 const Operator* LoadContext(size_t depth, size_t index, bool immutable); | 481 const Operator* LoadContext(size_t depth, size_t index, bool immutable); |
431 const Operator* StoreContext(size_t depth, size_t index); | 482 const Operator* StoreContext(size_t depth, size_t index); |
432 | 483 |
| 484 const Operator* LoadNativeContext(); |
| 485 |
433 const Operator* LoadDynamic(const Handle<String>& name, | 486 const Operator* LoadDynamic(const Handle<String>& name, |
434 TypeofMode typeof_mode); | 487 TypeofMode typeof_mode); |
435 | 488 |
436 const Operator* TypeOf(); | 489 const Operator* TypeOf(); |
437 const Operator* InstanceOf(); | 490 const Operator* InstanceOf(); |
438 | 491 |
439 const Operator* ForInDone(); | 492 const Operator* ForInDone(); |
440 const Operator* ForInNext(); | 493 const Operator* ForInNext(); |
441 const Operator* ForInPrepare(); | 494 const Operator* ForInPrepare(); |
442 const Operator* ForInStep(); | 495 const Operator* ForInStep(); |
(...skipping 17 matching lines...) Expand all Loading... |
460 Zone* const zone_; | 513 Zone* const zone_; |
461 | 514 |
462 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 515 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
463 }; | 516 }; |
464 | 517 |
465 } // namespace compiler | 518 } // namespace compiler |
466 } // namespace internal | 519 } // namespace internal |
467 } // namespace v8 | 520 } // namespace v8 |
468 | 521 |
469 #endif // V8_COMPILER_JS_OPERATOR_H_ | 522 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |