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( | |
360 size_t arity, | |
361 MaybeHandle<AllocationSite> site = MaybeHandle<AllocationSite>()) | |
362 : arity_(arity), site_(site) {} | |
363 | |
364 size_t arity() const { return arity_; } | |
365 MaybeHandle<AllocationSite> site() const { return site_; } | |
366 | |
367 private: | |
368 size_t const arity_; | |
369 MaybeHandle<AllocationSite> const site_; | |
370 }; | |
371 | |
372 bool operator==(CreateArrayParameters const&, CreateArrayParameters const&); | |
373 bool operator!=(CreateArrayParameters const&, CreateArrayParameters const&); | |
374 | |
375 size_t hash_value(CreateArrayParameters const&); | |
376 | |
377 std::ostream& operator<<(std::ostream&, CreateArrayParameters const&); | |
378 | |
379 const CreateArrayParameters& CreateArrayParametersOf(const Operator* op); | |
380 | |
381 | |
330 // Defines shared information for the closure that should be created. This is | 382 // Defines shared information for the closure that should be created. This is |
331 // used as a parameter by JSCreateClosure operators. | 383 // used as a parameter by JSCreateClosure operators. |
332 class CreateClosureParameters final { | 384 class CreateClosureParameters final { |
333 public: | 385 public: |
334 CreateClosureParameters(Handle<SharedFunctionInfo> shared_info, | 386 CreateClosureParameters(Handle<SharedFunctionInfo> shared_info, |
335 PretenureFlag pretenure) | 387 PretenureFlag pretenure) |
336 : shared_info_(shared_info), pretenure_(pretenure) {} | 388 : shared_info_(shared_info), pretenure_(pretenure) {} |
337 | 389 |
338 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 390 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
339 PretenureFlag pretenure() const { return pretenure_; } | 391 PretenureFlag pretenure() const { return pretenure_; } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 const Operator* ToBoolean(); | 436 const Operator* ToBoolean(); |
385 const Operator* ToNumber(); | 437 const Operator* ToNumber(); |
386 const Operator* ToString(); | 438 const Operator* ToString(); |
387 const Operator* ToName(); | 439 const Operator* ToName(); |
388 const Operator* ToObject(); | 440 const Operator* ToObject(); |
389 const Operator* Yield(); | 441 const Operator* Yield(); |
390 | 442 |
391 const Operator* Create(); | 443 const Operator* Create(); |
392 const Operator* CreateArguments(CreateArgumentsParameters::Type type, | 444 const Operator* CreateArguments(CreateArgumentsParameters::Type type, |
393 int start_index); | 445 int start_index); |
446 const Operator* CreateArray(size_t arity, MaybeHandle<AllocationSite> site); | |
394 const Operator* CreateClosure(Handle<SharedFunctionInfo> shared_info, | 447 const Operator* CreateClosure(Handle<SharedFunctionInfo> shared_info, |
395 PretenureFlag pretenure); | 448 PretenureFlag pretenure); |
396 const Operator* CreateLiteralArray(int literal_flags); | 449 const Operator* CreateLiteralArray(int literal_flags); |
397 const Operator* CreateLiteralObject(int literal_flags); | 450 const Operator* CreateLiteralObject(int literal_flags); |
398 | 451 |
399 const Operator* CallFunction( | 452 const Operator* CallFunction( |
400 size_t arity, LanguageMode language_mode, | 453 size_t arity, LanguageMode language_mode, |
401 VectorSlotPair const& feedback = VectorSlotPair(), | 454 VectorSlotPair const& feedback = VectorSlotPair(), |
402 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, | 455 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, |
403 TailCallMode tail_call_mode = TailCallMode::kDisallow); | 456 TailCallMode tail_call_mode = TailCallMode::kDisallow); |
404 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); | 457 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); |
405 const Operator* CallConstruct(int arguments); | 458 const Operator* CallConstruct( |
459 size_t arity, VectorSlotPair const& feedback = VectorSlotPair()); | |
Michael Starzinger
2015/11/20 12:06:47
nit: Could we drop the default value? I would vote
Benedikt Meurer
2015/11/20 12:28:52
Done.
| |
406 | 460 |
407 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); | 461 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); |
408 | 462 |
409 const Operator* LoadProperty(LanguageMode language_mode, | 463 const Operator* LoadProperty(LanguageMode language_mode, |
410 VectorSlotPair const& feedback); | 464 VectorSlotPair const& feedback); |
411 const Operator* LoadNamed(LanguageMode language_mode, Handle<Name> name, | 465 const Operator* LoadNamed(LanguageMode language_mode, Handle<Name> name, |
412 VectorSlotPair const& feedback); | 466 VectorSlotPair const& feedback); |
413 | 467 |
414 const Operator* StoreProperty(LanguageMode language_mode, | 468 const Operator* StoreProperty(LanguageMode language_mode, |
415 VectorSlotPair const& feedback); | 469 VectorSlotPair const& feedback); |
416 const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name, | 470 const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name, |
417 VectorSlotPair const& feedback); | 471 VectorSlotPair const& feedback); |
418 | 472 |
419 const Operator* DeleteProperty(LanguageMode language_mode); | 473 const Operator* DeleteProperty(LanguageMode language_mode); |
420 | 474 |
421 const Operator* HasProperty(); | 475 const Operator* HasProperty(); |
422 | 476 |
423 const Operator* LoadGlobal(const Handle<Name>& name, | 477 const Operator* LoadGlobal(const Handle<Name>& name, |
424 const VectorSlotPair& feedback, | 478 const VectorSlotPair& feedback, |
425 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); | 479 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); |
426 const Operator* StoreGlobal(LanguageMode language_mode, | 480 const Operator* StoreGlobal(LanguageMode language_mode, |
427 const Handle<Name>& name, | 481 const Handle<Name>& name, |
428 const VectorSlotPair& feedback); | 482 const VectorSlotPair& feedback); |
429 | 483 |
430 const Operator* LoadContext(size_t depth, size_t index, bool immutable); | 484 const Operator* LoadContext(size_t depth, size_t index, bool immutable); |
431 const Operator* StoreContext(size_t depth, size_t index); | 485 const Operator* StoreContext(size_t depth, size_t index); |
432 | 486 |
487 const Operator* LoadNativeContext(); | |
Michael Starzinger
2015/11/20 12:06:47
nit: Move this down a bit so that the variable loa
Benedikt Meurer
2015/11/20 12:28:52
As discussed offline: This will die once the conte
Benedikt Meurer
2015/11/20 12:28:52
Done.
| |
488 | |
433 const Operator* LoadDynamic(const Handle<String>& name, | 489 const Operator* LoadDynamic(const Handle<String>& name, |
434 TypeofMode typeof_mode); | 490 TypeofMode typeof_mode); |
435 | 491 |
436 const Operator* TypeOf(); | 492 const Operator* TypeOf(); |
437 const Operator* InstanceOf(); | 493 const Operator* InstanceOf(); |
438 | 494 |
439 const Operator* ForInDone(); | 495 const Operator* ForInDone(); |
440 const Operator* ForInNext(); | 496 const Operator* ForInNext(); |
441 const Operator* ForInPrepare(); | 497 const Operator* ForInPrepare(); |
442 const Operator* ForInStep(); | 498 const Operator* ForInStep(); |
(...skipping 17 matching lines...) Expand all Loading... | |
460 Zone* const zone_; | 516 Zone* const zone_; |
461 | 517 |
462 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 518 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
463 }; | 519 }; |
464 | 520 |
465 } // namespace compiler | 521 } // namespace compiler |
466 } // namespace internal | 522 } // namespace internal |
467 } // namespace v8 | 523 } // namespace v8 |
468 | 524 |
469 #endif // V8_COMPILER_JS_OPERATOR_H_ | 525 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |