| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 type* As##type() { return Is##type() ? reinterpret_cast<type*>(this) : NULL; } | 219 type* As##type() { return Is##type() ? reinterpret_cast<type*>(this) : NULL; } |
| 220 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 220 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 221 #undef DECLARE_NODE_FUNCTIONS | 221 #undef DECLARE_NODE_FUNCTIONS |
| 222 | 222 |
| 223 virtual TargetCollector* AsTargetCollector() { return NULL; } | 223 virtual TargetCollector* AsTargetCollector() { return NULL; } |
| 224 virtual BreakableStatement* AsBreakableStatement() { return NULL; } | 224 virtual BreakableStatement* AsBreakableStatement() { return NULL; } |
| 225 virtual IterationStatement* AsIterationStatement() { return NULL; } | 225 virtual IterationStatement* AsIterationStatement() { return NULL; } |
| 226 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } | 226 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } |
| 227 | 227 |
| 228 protected: | 228 protected: |
| 229 static int GetNextId(Isolate* isolate) { | 229 static int GetNextId(Zone* zone) { |
| 230 return ReserveIdRange(isolate, 1); | 230 return ReserveIdRange(zone, 1); |
| 231 } | 231 } |
| 232 | 232 |
| 233 static int ReserveIdRange(Isolate* isolate, int n) { | 233 static int ReserveIdRange(Zone* zone, int n) { |
| 234 int tmp = isolate->ast_node_id(); | 234 int tmp = zone->isolate()->ast_node_id(); |
| 235 isolate->set_ast_node_id(tmp + n); | 235 zone->isolate()->set_ast_node_id(tmp + n); |
| 236 return tmp; | 236 return tmp; |
| 237 } | 237 } |
| 238 | 238 |
| 239 // Some nodes re-use bailout IDs for type feedback. | 239 // Some nodes re-use bailout IDs for type feedback. |
| 240 static TypeFeedbackId reuse(BailoutId id) { | 240 static TypeFeedbackId reuse(BailoutId id) { |
| 241 return TypeFeedbackId(id.ToInt()); | 241 return TypeFeedbackId(id.ToInt()); |
| 242 } | 242 } |
| 243 | 243 |
| 244 | 244 |
| 245 private: | 245 private: |
| 246 // Hidden to prevent accidental usage. It would have to load the | 246 // Hidden to prevent accidental usage. It would have to load the |
| 247 // current zone from the TLS. | 247 // current zone from the TLS. |
| 248 void* operator new(size_t size); | 248 void* operator new(size_t size); |
| 249 | 249 |
| 250 friend class CaseClause; // Generates AST IDs. | 250 friend class CaseClause; // Generates AST IDs. |
| 251 | 251 |
| 252 int position_; | 252 int position_; |
| 253 }; | 253 }; |
| 254 | 254 |
| 255 | 255 |
| 256 class Statement : public AstNode { | 256 class Statement : public AstNode { |
| 257 public: | 257 public: |
| 258 explicit Statement(int position) : AstNode(position) {} | 258 explicit Statement(Zone* zone, int position) : AstNode(position) {} |
| 259 | 259 |
| 260 bool IsEmpty() { return AsEmptyStatement() != NULL; } | 260 bool IsEmpty() { return AsEmptyStatement() != NULL; } |
| 261 virtual bool IsJump() const { return false; } | 261 virtual bool IsJump() const { return false; } |
| 262 }; | 262 }; |
| 263 | 263 |
| 264 | 264 |
| 265 class SmallMapList V8_FINAL { | 265 class SmallMapList V8_FINAL { |
| 266 public: | 266 public: |
| 267 SmallMapList() {} | 267 SmallMapList() {} |
| 268 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} | 268 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 } | 370 } |
| 371 | 371 |
| 372 // TODO(rossberg): this should move to its own AST node eventually. | 372 // TODO(rossberg): this should move to its own AST node eventually. |
| 373 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 373 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
| 374 byte to_boolean_types() const { return to_boolean_types_; } | 374 byte to_boolean_types() const { return to_boolean_types_; } |
| 375 | 375 |
| 376 BailoutId id() const { return id_; } | 376 BailoutId id() const { return id_; } |
| 377 TypeFeedbackId test_id() const { return test_id_; } | 377 TypeFeedbackId test_id() const { return test_id_; } |
| 378 | 378 |
| 379 protected: | 379 protected: |
| 380 Expression(Isolate* isolate, int pos) | 380 Expression(Zone* zone, int pos) |
| 381 : AstNode(pos), | 381 : AstNode(pos), |
| 382 bounds_(Bounds::Unbounded(isolate)), | 382 bounds_(Bounds::Unbounded(zone)), |
| 383 id_(GetNextId(isolate)), | 383 id_(GetNextId(zone)), |
| 384 test_id_(GetNextId(isolate)) {} | 384 test_id_(GetNextId(zone)) {} |
| 385 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } | 385 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } |
| 386 | 386 |
| 387 private: | 387 private: |
| 388 Bounds bounds_; | 388 Bounds bounds_; |
| 389 byte to_boolean_types_; | 389 byte to_boolean_types_; |
| 390 | 390 |
| 391 const BailoutId id_; | 391 const BailoutId id_; |
| 392 const TypeFeedbackId test_id_; | 392 const TypeFeedbackId test_id_; |
| 393 }; | 393 }; |
| 394 | 394 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 415 // Testers. | 415 // Testers. |
| 416 bool is_target_for_anonymous() const { | 416 bool is_target_for_anonymous() const { |
| 417 return breakable_type_ == TARGET_FOR_ANONYMOUS; | 417 return breakable_type_ == TARGET_FOR_ANONYMOUS; |
| 418 } | 418 } |
| 419 | 419 |
| 420 BailoutId EntryId() const { return entry_id_; } | 420 BailoutId EntryId() const { return entry_id_; } |
| 421 BailoutId ExitId() const { return exit_id_; } | 421 BailoutId ExitId() const { return exit_id_; } |
| 422 | 422 |
| 423 protected: | 423 protected: |
| 424 BreakableStatement( | 424 BreakableStatement( |
| 425 Isolate* isolate, ZoneStringList* labels, | 425 Zone* zone, ZoneStringList* labels, |
| 426 BreakableType breakable_type, int position) | 426 BreakableType breakable_type, int position) |
| 427 : Statement(position), | 427 : Statement(zone, position), |
| 428 labels_(labels), | 428 labels_(labels), |
| 429 breakable_type_(breakable_type), | 429 breakable_type_(breakable_type), |
| 430 entry_id_(GetNextId(isolate)), | 430 entry_id_(GetNextId(zone)), |
| 431 exit_id_(GetNextId(isolate)) { | 431 exit_id_(GetNextId(zone)) { |
| 432 ASSERT(labels == NULL || labels->length() > 0); | 432 ASSERT(labels == NULL || labels->length() > 0); |
| 433 } | 433 } |
| 434 | 434 |
| 435 | 435 |
| 436 private: | 436 private: |
| 437 ZoneStringList* labels_; | 437 ZoneStringList* labels_; |
| 438 BreakableType breakable_type_; | 438 BreakableType breakable_type_; |
| 439 Label break_target_; | 439 Label break_target_; |
| 440 const BailoutId entry_id_; | 440 const BailoutId entry_id_; |
| 441 const BailoutId exit_id_; | 441 const BailoutId exit_id_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 455 | 455 |
| 456 virtual bool IsJump() const V8_OVERRIDE { | 456 virtual bool IsJump() const V8_OVERRIDE { |
| 457 return !statements_.is_empty() && statements_.last()->IsJump() | 457 return !statements_.is_empty() && statements_.last()->IsJump() |
| 458 && labels() == NULL; // Good enough as an approximation... | 458 && labels() == NULL; // Good enough as an approximation... |
| 459 } | 459 } |
| 460 | 460 |
| 461 Scope* scope() const { return scope_; } | 461 Scope* scope() const { return scope_; } |
| 462 void set_scope(Scope* scope) { scope_ = scope; } | 462 void set_scope(Scope* scope) { scope_ = scope; } |
| 463 | 463 |
| 464 protected: | 464 protected: |
| 465 Block(Isolate* isolate, | 465 Block(Zone* zone, |
| 466 ZoneStringList* labels, | 466 ZoneStringList* labels, |
| 467 int capacity, | 467 int capacity, |
| 468 bool is_initializer_block, | 468 bool is_initializer_block, |
| 469 int pos, | 469 int pos) |
| 470 Zone* zone) | 470 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos), |
| 471 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY, pos), | |
| 472 statements_(capacity, zone), | 471 statements_(capacity, zone), |
| 473 is_initializer_block_(is_initializer_block), | 472 is_initializer_block_(is_initializer_block), |
| 474 scope_(NULL) { | 473 scope_(NULL) { |
| 475 } | 474 } |
| 476 | 475 |
| 477 private: | 476 private: |
| 478 ZoneList<Statement*> statements_; | 477 ZoneList<Statement*> statements_; |
| 479 bool is_initializer_block_; | 478 bool is_initializer_block_; |
| 480 Scope* scope_; | 479 Scope* scope_; |
| 481 }; | 480 }; |
| 482 | 481 |
| 483 | 482 |
| 484 class Declaration : public AstNode { | 483 class Declaration : public AstNode { |
| 485 public: | 484 public: |
| 486 VariableProxy* proxy() const { return proxy_; } | 485 VariableProxy* proxy() const { return proxy_; } |
| 487 VariableMode mode() const { return mode_; } | 486 VariableMode mode() const { return mode_; } |
| 488 Scope* scope() const { return scope_; } | 487 Scope* scope() const { return scope_; } |
| 489 virtual InitializationFlag initialization() const = 0; | 488 virtual InitializationFlag initialization() const = 0; |
| 490 virtual bool IsInlineable() const; | 489 virtual bool IsInlineable() const; |
| 491 | 490 |
| 492 protected: | 491 protected: |
| 493 Declaration(VariableProxy* proxy, | 492 Declaration(Zone* zone, |
| 493 VariableProxy* proxy, |
| 494 VariableMode mode, | 494 VariableMode mode, |
| 495 Scope* scope, | 495 Scope* scope, |
| 496 int pos) | 496 int pos) |
| 497 : AstNode(pos), | 497 : AstNode(pos), |
| 498 proxy_(proxy), | 498 proxy_(proxy), |
| 499 mode_(mode), | 499 mode_(mode), |
| 500 scope_(scope) { | 500 scope_(scope) { |
| 501 ASSERT(IsDeclaredVariableMode(mode)); | 501 ASSERT(IsDeclaredVariableMode(mode)); |
| 502 } | 502 } |
| 503 | 503 |
| 504 private: | 504 private: |
| 505 VariableProxy* proxy_; | 505 VariableProxy* proxy_; |
| 506 VariableMode mode_; | 506 VariableMode mode_; |
| 507 | 507 |
| 508 // Nested scope from which the declaration originated. | 508 // Nested scope from which the declaration originated. |
| 509 Scope* scope_; | 509 Scope* scope_; |
| 510 }; | 510 }; |
| 511 | 511 |
| 512 | 512 |
| 513 class VariableDeclaration V8_FINAL : public Declaration { | 513 class VariableDeclaration V8_FINAL : public Declaration { |
| 514 public: | 514 public: |
| 515 DECLARE_NODE_TYPE(VariableDeclaration) | 515 DECLARE_NODE_TYPE(VariableDeclaration) |
| 516 | 516 |
| 517 virtual InitializationFlag initialization() const V8_OVERRIDE { | 517 virtual InitializationFlag initialization() const V8_OVERRIDE { |
| 518 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; | 518 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; |
| 519 } | 519 } |
| 520 | 520 |
| 521 protected: | 521 protected: |
| 522 VariableDeclaration(VariableProxy* proxy, | 522 VariableDeclaration(Zone* zone, |
| 523 VariableProxy* proxy, |
| 523 VariableMode mode, | 524 VariableMode mode, |
| 524 Scope* scope, | 525 Scope* scope, |
| 525 int pos) | 526 int pos) |
| 526 : Declaration(proxy, mode, scope, pos) { | 527 : Declaration(zone, proxy, mode, scope, pos) { |
| 527 } | 528 } |
| 528 }; | 529 }; |
| 529 | 530 |
| 530 | 531 |
| 531 class FunctionDeclaration V8_FINAL : public Declaration { | 532 class FunctionDeclaration V8_FINAL : public Declaration { |
| 532 public: | 533 public: |
| 533 DECLARE_NODE_TYPE(FunctionDeclaration) | 534 DECLARE_NODE_TYPE(FunctionDeclaration) |
| 534 | 535 |
| 535 FunctionLiteral* fun() const { return fun_; } | 536 FunctionLiteral* fun() const { return fun_; } |
| 536 virtual InitializationFlag initialization() const V8_OVERRIDE { | 537 virtual InitializationFlag initialization() const V8_OVERRIDE { |
| 537 return kCreatedInitialized; | 538 return kCreatedInitialized; |
| 538 } | 539 } |
| 539 virtual bool IsInlineable() const V8_OVERRIDE; | 540 virtual bool IsInlineable() const V8_OVERRIDE; |
| 540 | 541 |
| 541 protected: | 542 protected: |
| 542 FunctionDeclaration(VariableProxy* proxy, | 543 FunctionDeclaration(Zone* zone, |
| 544 VariableProxy* proxy, |
| 543 VariableMode mode, | 545 VariableMode mode, |
| 544 FunctionLiteral* fun, | 546 FunctionLiteral* fun, |
| 545 Scope* scope, | 547 Scope* scope, |
| 546 int pos) | 548 int pos) |
| 547 : Declaration(proxy, mode, scope, pos), | 549 : Declaration(zone, proxy, mode, scope, pos), |
| 548 fun_(fun) { | 550 fun_(fun) { |
| 549 // At the moment there are no "const functions" in JavaScript... | 551 // At the moment there are no "const functions" in JavaScript... |
| 550 ASSERT(mode == VAR || mode == LET); | 552 ASSERT(mode == VAR || mode == LET); |
| 551 ASSERT(fun != NULL); | 553 ASSERT(fun != NULL); |
| 552 } | 554 } |
| 553 | 555 |
| 554 private: | 556 private: |
| 555 FunctionLiteral* fun_; | 557 FunctionLiteral* fun_; |
| 556 }; | 558 }; |
| 557 | 559 |
| 558 | 560 |
| 559 class ModuleDeclaration V8_FINAL : public Declaration { | 561 class ModuleDeclaration V8_FINAL : public Declaration { |
| 560 public: | 562 public: |
| 561 DECLARE_NODE_TYPE(ModuleDeclaration) | 563 DECLARE_NODE_TYPE(ModuleDeclaration) |
| 562 | 564 |
| 563 Module* module() const { return module_; } | 565 Module* module() const { return module_; } |
| 564 virtual InitializationFlag initialization() const V8_OVERRIDE { | 566 virtual InitializationFlag initialization() const V8_OVERRIDE { |
| 565 return kCreatedInitialized; | 567 return kCreatedInitialized; |
| 566 } | 568 } |
| 567 | 569 |
| 568 protected: | 570 protected: |
| 569 ModuleDeclaration(VariableProxy* proxy, | 571 ModuleDeclaration(Zone* zone, |
| 572 VariableProxy* proxy, |
| 570 Module* module, | 573 Module* module, |
| 571 Scope* scope, | 574 Scope* scope, |
| 572 int pos) | 575 int pos) |
| 573 : Declaration(proxy, MODULE, scope, pos), | 576 : Declaration(zone, proxy, MODULE, scope, pos), |
| 574 module_(module) { | 577 module_(module) { |
| 575 } | 578 } |
| 576 | 579 |
| 577 private: | 580 private: |
| 578 Module* module_; | 581 Module* module_; |
| 579 }; | 582 }; |
| 580 | 583 |
| 581 | 584 |
| 582 class ImportDeclaration V8_FINAL : public Declaration { | 585 class ImportDeclaration V8_FINAL : public Declaration { |
| 583 public: | 586 public: |
| 584 DECLARE_NODE_TYPE(ImportDeclaration) | 587 DECLARE_NODE_TYPE(ImportDeclaration) |
| 585 | 588 |
| 586 Module* module() const { return module_; } | 589 Module* module() const { return module_; } |
| 587 virtual InitializationFlag initialization() const V8_OVERRIDE { | 590 virtual InitializationFlag initialization() const V8_OVERRIDE { |
| 588 return kCreatedInitialized; | 591 return kCreatedInitialized; |
| 589 } | 592 } |
| 590 | 593 |
| 591 protected: | 594 protected: |
| 592 ImportDeclaration(VariableProxy* proxy, | 595 ImportDeclaration(Zone* zone, |
| 596 VariableProxy* proxy, |
| 593 Module* module, | 597 Module* module, |
| 594 Scope* scope, | 598 Scope* scope, |
| 595 int pos) | 599 int pos) |
| 596 : Declaration(proxy, LET, scope, pos), | 600 : Declaration(zone, proxy, LET, scope, pos), |
| 597 module_(module) { | 601 module_(module) { |
| 598 } | 602 } |
| 599 | 603 |
| 600 private: | 604 private: |
| 601 Module* module_; | 605 Module* module_; |
| 602 }; | 606 }; |
| 603 | 607 |
| 604 | 608 |
| 605 class ExportDeclaration V8_FINAL : public Declaration { | 609 class ExportDeclaration V8_FINAL : public Declaration { |
| 606 public: | 610 public: |
| 607 DECLARE_NODE_TYPE(ExportDeclaration) | 611 DECLARE_NODE_TYPE(ExportDeclaration) |
| 608 | 612 |
| 609 virtual InitializationFlag initialization() const V8_OVERRIDE { | 613 virtual InitializationFlag initialization() const V8_OVERRIDE { |
| 610 return kCreatedInitialized; | 614 return kCreatedInitialized; |
| 611 } | 615 } |
| 612 | 616 |
| 613 protected: | 617 protected: |
| 614 ExportDeclaration(VariableProxy* proxy, Scope* scope, int pos) | 618 ExportDeclaration(Zone* zone, VariableProxy* proxy, Scope* scope, int pos) |
| 615 : Declaration(proxy, LET, scope, pos) {} | 619 : Declaration(zone, proxy, LET, scope, pos) {} |
| 616 }; | 620 }; |
| 617 | 621 |
| 618 | 622 |
| 619 class Module : public AstNode { | 623 class Module : public AstNode { |
| 620 public: | 624 public: |
| 621 Interface* interface() const { return interface_; } | 625 Interface* interface() const { return interface_; } |
| 622 Block* body() const { return body_; } | 626 Block* body() const { return body_; } |
| 623 | 627 |
| 624 protected: | 628 protected: |
| 625 Module(Zone* zone, int pos) | 629 Module(Zone* zone, int pos) |
| 626 : AstNode(pos), | 630 : AstNode(pos), |
| 627 interface_(Interface::NewModule(zone)), | 631 interface_(Interface::NewModule(zone)), |
| 628 body_(NULL) {} | 632 body_(NULL) {} |
| 629 Module(Interface* interface, int pos, Block* body = NULL) | 633 Module(Zone* zone, Interface* interface, int pos, Block* body = NULL) |
| 630 : AstNode(pos), | 634 : AstNode(pos), |
| 631 interface_(interface), | 635 interface_(interface), |
| 632 body_(body) {} | 636 body_(body) {} |
| 633 | 637 |
| 634 private: | 638 private: |
| 635 Interface* interface_; | 639 Interface* interface_; |
| 636 Block* body_; | 640 Block* body_; |
| 637 }; | 641 }; |
| 638 | 642 |
| 639 | 643 |
| 640 class ModuleLiteral V8_FINAL : public Module { | 644 class ModuleLiteral V8_FINAL : public Module { |
| 641 public: | 645 public: |
| 642 DECLARE_NODE_TYPE(ModuleLiteral) | 646 DECLARE_NODE_TYPE(ModuleLiteral) |
| 643 | 647 |
| 644 protected: | 648 protected: |
| 645 ModuleLiteral(Block* body, Interface* interface, int pos) | 649 ModuleLiteral(Zone* zone, Block* body, Interface* interface, int pos) |
| 646 : Module(interface, pos, body) {} | 650 : Module(zone, interface, pos, body) {} |
| 647 }; | 651 }; |
| 648 | 652 |
| 649 | 653 |
| 650 class ModuleVariable V8_FINAL : public Module { | 654 class ModuleVariable V8_FINAL : public Module { |
| 651 public: | 655 public: |
| 652 DECLARE_NODE_TYPE(ModuleVariable) | 656 DECLARE_NODE_TYPE(ModuleVariable) |
| 653 | 657 |
| 654 VariableProxy* proxy() const { return proxy_; } | 658 VariableProxy* proxy() const { return proxy_; } |
| 655 | 659 |
| 656 protected: | 660 protected: |
| 657 inline ModuleVariable(VariableProxy* proxy, int pos); | 661 inline ModuleVariable(Zone* zone, VariableProxy* proxy, int pos); |
| 658 | 662 |
| 659 private: | 663 private: |
| 660 VariableProxy* proxy_; | 664 VariableProxy* proxy_; |
| 661 }; | 665 }; |
| 662 | 666 |
| 663 | 667 |
| 664 class ModulePath V8_FINAL : public Module { | 668 class ModulePath V8_FINAL : public Module { |
| 665 public: | 669 public: |
| 666 DECLARE_NODE_TYPE(ModulePath) | 670 DECLARE_NODE_TYPE(ModulePath) |
| 667 | 671 |
| 668 Module* module() const { return module_; } | 672 Module* module() const { return module_; } |
| 669 Handle<String> name() const { return name_; } | 673 Handle<String> name() const { return name_; } |
| 670 | 674 |
| 671 protected: | 675 protected: |
| 672 ModulePath(Module* module, Handle<String> name, Zone* zone, int pos) | 676 ModulePath(Zone* zone, Module* module, Handle<String> name, int pos) |
| 673 : Module(zone, pos), | 677 : Module(zone, pos), |
| 674 module_(module), | 678 module_(module), |
| 675 name_(name) { | 679 name_(name) { |
| 676 } | 680 } |
| 677 | 681 |
| 678 private: | 682 private: |
| 679 Module* module_; | 683 Module* module_; |
| 680 Handle<String> name_; | 684 Handle<String> name_; |
| 681 }; | 685 }; |
| 682 | 686 |
| 683 | 687 |
| 684 class ModuleUrl V8_FINAL : public Module { | 688 class ModuleUrl V8_FINAL : public Module { |
| 685 public: | 689 public: |
| 686 DECLARE_NODE_TYPE(ModuleUrl) | 690 DECLARE_NODE_TYPE(ModuleUrl) |
| 687 | 691 |
| 688 Handle<String> url() const { return url_; } | 692 Handle<String> url() const { return url_; } |
| 689 | 693 |
| 690 protected: | 694 protected: |
| 691 ModuleUrl(Handle<String> url, Zone* zone, int pos) | 695 ModuleUrl(Zone* zone, Handle<String> url, int pos) |
| 692 : Module(zone, pos), url_(url) { | 696 : Module(zone, pos), url_(url) { |
| 693 } | 697 } |
| 694 | 698 |
| 695 private: | 699 private: |
| 696 Handle<String> url_; | 700 Handle<String> url_; |
| 697 }; | 701 }; |
| 698 | 702 |
| 699 | 703 |
| 700 class ModuleStatement V8_FINAL : public Statement { | 704 class ModuleStatement V8_FINAL : public Statement { |
| 701 public: | 705 public: |
| 702 DECLARE_NODE_TYPE(ModuleStatement) | 706 DECLARE_NODE_TYPE(ModuleStatement) |
| 703 | 707 |
| 704 VariableProxy* proxy() const { return proxy_; } | 708 VariableProxy* proxy() const { return proxy_; } |
| 705 Block* body() const { return body_; } | 709 Block* body() const { return body_; } |
| 706 | 710 |
| 707 protected: | 711 protected: |
| 708 ModuleStatement(VariableProxy* proxy, Block* body, int pos) | 712 ModuleStatement(Zone* zone, VariableProxy* proxy, Block* body, int pos) |
| 709 : Statement(pos), | 713 : Statement(zone, pos), |
| 710 proxy_(proxy), | 714 proxy_(proxy), |
| 711 body_(body) { | 715 body_(body) { |
| 712 } | 716 } |
| 713 | 717 |
| 714 private: | 718 private: |
| 715 VariableProxy* proxy_; | 719 VariableProxy* proxy_; |
| 716 Block* body_; | 720 Block* body_; |
| 717 }; | 721 }; |
| 718 | 722 |
| 719 | 723 |
| 720 class IterationStatement : public BreakableStatement { | 724 class IterationStatement : public BreakableStatement { |
| 721 public: | 725 public: |
| 722 // Type testing & conversion. | 726 // Type testing & conversion. |
| 723 virtual IterationStatement* AsIterationStatement() V8_FINAL V8_OVERRIDE { | 727 virtual IterationStatement* AsIterationStatement() V8_FINAL V8_OVERRIDE { |
| 724 return this; | 728 return this; |
| 725 } | 729 } |
| 726 | 730 |
| 727 Statement* body() const { return body_; } | 731 Statement* body() const { return body_; } |
| 728 | 732 |
| 729 BailoutId OsrEntryId() const { return osr_entry_id_; } | 733 BailoutId OsrEntryId() const { return osr_entry_id_; } |
| 730 virtual BailoutId ContinueId() const = 0; | 734 virtual BailoutId ContinueId() const = 0; |
| 731 virtual BailoutId StackCheckId() const = 0; | 735 virtual BailoutId StackCheckId() const = 0; |
| 732 | 736 |
| 733 // Code generation | 737 // Code generation |
| 734 Label* continue_target() { return &continue_target_; } | 738 Label* continue_target() { return &continue_target_; } |
| 735 | 739 |
| 736 protected: | 740 protected: |
| 737 IterationStatement(Isolate* isolate, ZoneStringList* labels, int pos) | 741 IterationStatement(Zone* zone, ZoneStringList* labels, int pos) |
| 738 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS, pos), | 742 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), |
| 739 body_(NULL), | 743 body_(NULL), |
| 740 osr_entry_id_(GetNextId(isolate)) { | 744 osr_entry_id_(GetNextId(zone)) { |
| 741 } | 745 } |
| 742 | 746 |
| 743 void Initialize(Statement* body) { | 747 void Initialize(Statement* body) { |
| 744 body_ = body; | 748 body_ = body; |
| 745 } | 749 } |
| 746 | 750 |
| 747 private: | 751 private: |
| 748 Statement* body_; | 752 Statement* body_; |
| 749 Label continue_target_; | 753 Label continue_target_; |
| 750 | 754 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 761 cond_ = cond; | 765 cond_ = cond; |
| 762 } | 766 } |
| 763 | 767 |
| 764 Expression* cond() const { return cond_; } | 768 Expression* cond() const { return cond_; } |
| 765 | 769 |
| 766 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } | 770 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } |
| 767 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; } | 771 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; } |
| 768 BailoutId BackEdgeId() const { return back_edge_id_; } | 772 BailoutId BackEdgeId() const { return back_edge_id_; } |
| 769 | 773 |
| 770 protected: | 774 protected: |
| 771 DoWhileStatement(Isolate* isolate, ZoneStringList* labels, int pos) | 775 DoWhileStatement(Zone* zone, ZoneStringList* labels, int pos) |
| 772 : IterationStatement(isolate, labels, pos), | 776 : IterationStatement(zone, labels, pos), |
| 773 cond_(NULL), | 777 cond_(NULL), |
| 774 continue_id_(GetNextId(isolate)), | 778 continue_id_(GetNextId(zone)), |
| 775 back_edge_id_(GetNextId(isolate)) { | 779 back_edge_id_(GetNextId(zone)) { |
| 776 } | 780 } |
| 777 | 781 |
| 778 private: | 782 private: |
| 779 Expression* cond_; | 783 Expression* cond_; |
| 780 | 784 |
| 781 const BailoutId continue_id_; | 785 const BailoutId continue_id_; |
| 782 const BailoutId back_edge_id_; | 786 const BailoutId back_edge_id_; |
| 783 }; | 787 }; |
| 784 | 788 |
| 785 | 789 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 798 } | 802 } |
| 799 void set_may_have_function_literal(bool value) { | 803 void set_may_have_function_literal(bool value) { |
| 800 may_have_function_literal_ = value; | 804 may_have_function_literal_ = value; |
| 801 } | 805 } |
| 802 | 806 |
| 803 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 807 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
| 804 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 808 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
| 805 BailoutId BodyId() const { return body_id_; } | 809 BailoutId BodyId() const { return body_id_; } |
| 806 | 810 |
| 807 protected: | 811 protected: |
| 808 WhileStatement(Isolate* isolate, ZoneStringList* labels, int pos) | 812 WhileStatement(Zone* zone, ZoneStringList* labels, int pos) |
| 809 : IterationStatement(isolate, labels, pos), | 813 : IterationStatement(zone, labels, pos), |
| 810 cond_(NULL), | 814 cond_(NULL), |
| 811 may_have_function_literal_(true), | 815 may_have_function_literal_(true), |
| 812 body_id_(GetNextId(isolate)) { | 816 body_id_(GetNextId(zone)) { |
| 813 } | 817 } |
| 814 | 818 |
| 815 private: | 819 private: |
| 816 Expression* cond_; | 820 Expression* cond_; |
| 817 | 821 |
| 818 // True if there is a function literal subexpression in the condition. | 822 // True if there is a function literal subexpression in the condition. |
| 819 bool may_have_function_literal_; | 823 bool may_have_function_literal_; |
| 820 | 824 |
| 821 const BailoutId body_id_; | 825 const BailoutId body_id_; |
| 822 }; | 826 }; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 849 | 853 |
| 850 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } | 854 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } |
| 851 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 855 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
| 852 BailoutId BodyId() const { return body_id_; } | 856 BailoutId BodyId() const { return body_id_; } |
| 853 | 857 |
| 854 bool is_fast_smi_loop() { return loop_variable_ != NULL; } | 858 bool is_fast_smi_loop() { return loop_variable_ != NULL; } |
| 855 Variable* loop_variable() { return loop_variable_; } | 859 Variable* loop_variable() { return loop_variable_; } |
| 856 void set_loop_variable(Variable* var) { loop_variable_ = var; } | 860 void set_loop_variable(Variable* var) { loop_variable_ = var; } |
| 857 | 861 |
| 858 protected: | 862 protected: |
| 859 ForStatement(Isolate* isolate, ZoneStringList* labels, int pos) | 863 ForStatement(Zone* zone, ZoneStringList* labels, int pos) |
| 860 : IterationStatement(isolate, labels, pos), | 864 : IterationStatement(zone, labels, pos), |
| 861 init_(NULL), | 865 init_(NULL), |
| 862 cond_(NULL), | 866 cond_(NULL), |
| 863 next_(NULL), | 867 next_(NULL), |
| 864 may_have_function_literal_(true), | 868 may_have_function_literal_(true), |
| 865 loop_variable_(NULL), | 869 loop_variable_(NULL), |
| 866 continue_id_(GetNextId(isolate)), | 870 continue_id_(GetNextId(zone)), |
| 867 body_id_(GetNextId(isolate)) { | 871 body_id_(GetNextId(zone)) { |
| 868 } | 872 } |
| 869 | 873 |
| 870 private: | 874 private: |
| 871 Statement* init_; | 875 Statement* init_; |
| 872 Expression* cond_; | 876 Expression* cond_; |
| 873 Statement* next_; | 877 Statement* next_; |
| 874 | 878 |
| 875 // True if there is a function literal subexpression in the condition. | 879 // True if there is a function literal subexpression in the condition. |
| 876 bool may_have_function_literal_; | 880 bool may_have_function_literal_; |
| 877 Variable* loop_variable_; | 881 Variable* loop_variable_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 891 void Initialize(Expression* each, Expression* subject, Statement* body) { | 895 void Initialize(Expression* each, Expression* subject, Statement* body) { |
| 892 IterationStatement::Initialize(body); | 896 IterationStatement::Initialize(body); |
| 893 each_ = each; | 897 each_ = each; |
| 894 subject_ = subject; | 898 subject_ = subject; |
| 895 } | 899 } |
| 896 | 900 |
| 897 Expression* each() const { return each_; } | 901 Expression* each() const { return each_; } |
| 898 Expression* subject() const { return subject_; } | 902 Expression* subject() const { return subject_; } |
| 899 | 903 |
| 900 protected: | 904 protected: |
| 901 ForEachStatement(Isolate* isolate, ZoneStringList* labels, int pos) | 905 ForEachStatement(Zone* zone, ZoneStringList* labels, int pos) |
| 902 : IterationStatement(isolate, labels, pos), | 906 : IterationStatement(zone, labels, pos), |
| 903 each_(NULL), | 907 each_(NULL), |
| 904 subject_(NULL) { | 908 subject_(NULL) { |
| 905 } | 909 } |
| 906 | 910 |
| 907 private: | 911 private: |
| 908 Expression* each_; | 912 Expression* each_; |
| 909 Expression* subject_; | 913 Expression* subject_; |
| 910 }; | 914 }; |
| 911 | 915 |
| 912 | 916 |
| 913 class ForInStatement V8_FINAL : public ForEachStatement { | 917 class ForInStatement V8_FINAL : public ForEachStatement { |
| 914 public: | 918 public: |
| 915 DECLARE_NODE_TYPE(ForInStatement) | 919 DECLARE_NODE_TYPE(ForInStatement) |
| 916 | 920 |
| 917 Expression* enumerable() const { | 921 Expression* enumerable() const { |
| 918 return subject(); | 922 return subject(); |
| 919 } | 923 } |
| 920 | 924 |
| 921 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } | 925 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } |
| 922 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 926 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
| 923 ForInType for_in_type() const { return for_in_type_; } | 927 ForInType for_in_type() const { return for_in_type_; } |
| 924 void set_for_in_type(ForInType type) { for_in_type_ = type; } | 928 void set_for_in_type(ForInType type) { for_in_type_ = type; } |
| 925 | 929 |
| 926 BailoutId BodyId() const { return body_id_; } | 930 BailoutId BodyId() const { return body_id_; } |
| 927 BailoutId PrepareId() const { return prepare_id_; } | 931 BailoutId PrepareId() const { return prepare_id_; } |
| 928 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 932 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
| 929 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 933 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
| 930 | 934 |
| 931 protected: | 935 protected: |
| 932 ForInStatement(Isolate* isolate, ZoneStringList* labels, int pos) | 936 ForInStatement(Zone* zone, ZoneStringList* labels, int pos) |
| 933 : ForEachStatement(isolate, labels, pos), | 937 : ForEachStatement(zone, labels, pos), |
| 934 for_in_type_(SLOW_FOR_IN), | 938 for_in_type_(SLOW_FOR_IN), |
| 935 body_id_(GetNextId(isolate)), | 939 body_id_(GetNextId(zone)), |
| 936 prepare_id_(GetNextId(isolate)) { | 940 prepare_id_(GetNextId(zone)) { |
| 937 } | 941 } |
| 938 | 942 |
| 939 ForInType for_in_type_; | 943 ForInType for_in_type_; |
| 940 const BailoutId body_id_; | 944 const BailoutId body_id_; |
| 941 const BailoutId prepare_id_; | 945 const BailoutId prepare_id_; |
| 942 }; | 946 }; |
| 943 | 947 |
| 944 | 948 |
| 945 class ForOfStatement V8_FINAL : public ForEachStatement { | 949 class ForOfStatement V8_FINAL : public ForEachStatement { |
| 946 public: | 950 public: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 Expression* assign_each() const { | 987 Expression* assign_each() const { |
| 984 return assign_each_; | 988 return assign_each_; |
| 985 } | 989 } |
| 986 | 990 |
| 987 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 991 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
| 988 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); } | 992 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); } |
| 989 | 993 |
| 990 BailoutId BackEdgeId() const { return back_edge_id_; } | 994 BailoutId BackEdgeId() const { return back_edge_id_; } |
| 991 | 995 |
| 992 protected: | 996 protected: |
| 993 ForOfStatement(Isolate* isolate, ZoneStringList* labels, int pos) | 997 ForOfStatement(Zone* zone, ZoneStringList* labels, int pos) |
| 994 : ForEachStatement(isolate, labels, pos), | 998 : ForEachStatement(zone, labels, pos), |
| 995 assign_iterator_(NULL), | 999 assign_iterator_(NULL), |
| 996 next_result_(NULL), | 1000 next_result_(NULL), |
| 997 result_done_(NULL), | 1001 result_done_(NULL), |
| 998 assign_each_(NULL), | 1002 assign_each_(NULL), |
| 999 back_edge_id_(GetNextId(isolate)) { | 1003 back_edge_id_(GetNextId(zone)) { |
| 1000 } | 1004 } |
| 1001 | 1005 |
| 1002 Expression* assign_iterator_; | 1006 Expression* assign_iterator_; |
| 1003 Expression* next_result_; | 1007 Expression* next_result_; |
| 1004 Expression* result_done_; | 1008 Expression* result_done_; |
| 1005 Expression* assign_each_; | 1009 Expression* assign_each_; |
| 1006 const BailoutId back_edge_id_; | 1010 const BailoutId back_edge_id_; |
| 1007 }; | 1011 }; |
| 1008 | 1012 |
| 1009 | 1013 |
| 1010 class ExpressionStatement V8_FINAL : public Statement { | 1014 class ExpressionStatement V8_FINAL : public Statement { |
| 1011 public: | 1015 public: |
| 1012 DECLARE_NODE_TYPE(ExpressionStatement) | 1016 DECLARE_NODE_TYPE(ExpressionStatement) |
| 1013 | 1017 |
| 1014 void set_expression(Expression* e) { expression_ = e; } | 1018 void set_expression(Expression* e) { expression_ = e; } |
| 1015 Expression* expression() const { return expression_; } | 1019 Expression* expression() const { return expression_; } |
| 1016 virtual bool IsJump() const V8_OVERRIDE { return expression_->IsThrow(); } | 1020 virtual bool IsJump() const V8_OVERRIDE { return expression_->IsThrow(); } |
| 1017 | 1021 |
| 1018 protected: | 1022 protected: |
| 1019 ExpressionStatement(Expression* expression, int pos) | 1023 ExpressionStatement(Zone* zone, Expression* expression, int pos) |
| 1020 : Statement(pos), expression_(expression) { } | 1024 : Statement(zone, pos), expression_(expression) { } |
| 1021 | 1025 |
| 1022 private: | 1026 private: |
| 1023 Expression* expression_; | 1027 Expression* expression_; |
| 1024 }; | 1028 }; |
| 1025 | 1029 |
| 1026 | 1030 |
| 1027 class JumpStatement : public Statement { | 1031 class JumpStatement : public Statement { |
| 1028 public: | 1032 public: |
| 1029 virtual bool IsJump() const V8_FINAL V8_OVERRIDE { return true; } | 1033 virtual bool IsJump() const V8_FINAL V8_OVERRIDE { return true; } |
| 1030 | 1034 |
| 1031 protected: | 1035 protected: |
| 1032 explicit JumpStatement(int pos) : Statement(pos) {} | 1036 explicit JumpStatement(Zone* zone, int pos) : Statement(zone, pos) {} |
| 1033 }; | 1037 }; |
| 1034 | 1038 |
| 1035 | 1039 |
| 1036 class ContinueStatement V8_FINAL : public JumpStatement { | 1040 class ContinueStatement V8_FINAL : public JumpStatement { |
| 1037 public: | 1041 public: |
| 1038 DECLARE_NODE_TYPE(ContinueStatement) | 1042 DECLARE_NODE_TYPE(ContinueStatement) |
| 1039 | 1043 |
| 1040 IterationStatement* target() const { return target_; } | 1044 IterationStatement* target() const { return target_; } |
| 1041 | 1045 |
| 1042 protected: | 1046 protected: |
| 1043 explicit ContinueStatement(IterationStatement* target, int pos) | 1047 explicit ContinueStatement(Zone* zone, IterationStatement* target, int pos) |
| 1044 : JumpStatement(pos), target_(target) { } | 1048 : JumpStatement(zone, pos), target_(target) { } |
| 1045 | 1049 |
| 1046 private: | 1050 private: |
| 1047 IterationStatement* target_; | 1051 IterationStatement* target_; |
| 1048 }; | 1052 }; |
| 1049 | 1053 |
| 1050 | 1054 |
| 1051 class BreakStatement V8_FINAL : public JumpStatement { | 1055 class BreakStatement V8_FINAL : public JumpStatement { |
| 1052 public: | 1056 public: |
| 1053 DECLARE_NODE_TYPE(BreakStatement) | 1057 DECLARE_NODE_TYPE(BreakStatement) |
| 1054 | 1058 |
| 1055 BreakableStatement* target() const { return target_; } | 1059 BreakableStatement* target() const { return target_; } |
| 1056 | 1060 |
| 1057 protected: | 1061 protected: |
| 1058 explicit BreakStatement(BreakableStatement* target, int pos) | 1062 explicit BreakStatement(Zone* zone, BreakableStatement* target, int pos) |
| 1059 : JumpStatement(pos), target_(target) { } | 1063 : JumpStatement(zone, pos), target_(target) { } |
| 1060 | 1064 |
| 1061 private: | 1065 private: |
| 1062 BreakableStatement* target_; | 1066 BreakableStatement* target_; |
| 1063 }; | 1067 }; |
| 1064 | 1068 |
| 1065 | 1069 |
| 1066 class ReturnStatement V8_FINAL : public JumpStatement { | 1070 class ReturnStatement V8_FINAL : public JumpStatement { |
| 1067 public: | 1071 public: |
| 1068 DECLARE_NODE_TYPE(ReturnStatement) | 1072 DECLARE_NODE_TYPE(ReturnStatement) |
| 1069 | 1073 |
| 1070 Expression* expression() const { return expression_; } | 1074 Expression* expression() const { return expression_; } |
| 1071 | 1075 |
| 1072 protected: | 1076 protected: |
| 1073 explicit ReturnStatement(Expression* expression, int pos) | 1077 explicit ReturnStatement(Zone* zone, Expression* expression, int pos) |
| 1074 : JumpStatement(pos), expression_(expression) { } | 1078 : JumpStatement(zone, pos), expression_(expression) { } |
| 1075 | 1079 |
| 1076 private: | 1080 private: |
| 1077 Expression* expression_; | 1081 Expression* expression_; |
| 1078 }; | 1082 }; |
| 1079 | 1083 |
| 1080 | 1084 |
| 1081 class WithStatement V8_FINAL : public Statement { | 1085 class WithStatement V8_FINAL : public Statement { |
| 1082 public: | 1086 public: |
| 1083 DECLARE_NODE_TYPE(WithStatement) | 1087 DECLARE_NODE_TYPE(WithStatement) |
| 1084 | 1088 |
| 1085 Scope* scope() { return scope_; } | 1089 Scope* scope() { return scope_; } |
| 1086 Expression* expression() const { return expression_; } | 1090 Expression* expression() const { return expression_; } |
| 1087 Statement* statement() const { return statement_; } | 1091 Statement* statement() const { return statement_; } |
| 1088 | 1092 |
| 1089 protected: | 1093 protected: |
| 1090 WithStatement( | 1094 WithStatement( |
| 1091 Scope* scope, Expression* expression, Statement* statement, int pos) | 1095 Zone* zone, Scope* scope, |
| 1092 : Statement(pos), | 1096 Expression* expression, Statement* statement, int pos) |
| 1097 : Statement(zone, pos), |
| 1093 scope_(scope), | 1098 scope_(scope), |
| 1094 expression_(expression), | 1099 expression_(expression), |
| 1095 statement_(statement) { } | 1100 statement_(statement) { } |
| 1096 | 1101 |
| 1097 private: | 1102 private: |
| 1098 Scope* scope_; | 1103 Scope* scope_; |
| 1099 Expression* expression_; | 1104 Expression* expression_; |
| 1100 Statement* statement_; | 1105 Statement* statement_; |
| 1101 }; | 1106 }; |
| 1102 | 1107 |
| 1103 | 1108 |
| 1104 class CaseClause V8_FINAL : public Expression { | 1109 class CaseClause V8_FINAL : public Expression { |
| 1105 public: | 1110 public: |
| 1106 DECLARE_NODE_TYPE(CaseClause) | 1111 DECLARE_NODE_TYPE(CaseClause) |
| 1107 | 1112 |
| 1108 bool is_default() const { return label_ == NULL; } | 1113 bool is_default() const { return label_ == NULL; } |
| 1109 Expression* label() const { | 1114 Expression* label() const { |
| 1110 CHECK(!is_default()); | 1115 CHECK(!is_default()); |
| 1111 return label_; | 1116 return label_; |
| 1112 } | 1117 } |
| 1113 Label* body_target() { return &body_target_; } | 1118 Label* body_target() { return &body_target_; } |
| 1114 ZoneList<Statement*>* statements() const { return statements_; } | 1119 ZoneList<Statement*>* statements() const { return statements_; } |
| 1115 | 1120 |
| 1116 BailoutId EntryId() const { return entry_id_; } | 1121 BailoutId EntryId() const { return entry_id_; } |
| 1117 | 1122 |
| 1118 // Type feedback information. | 1123 // Type feedback information. |
| 1119 TypeFeedbackId CompareId() { return compare_id_; } | 1124 TypeFeedbackId CompareId() { return compare_id_; } |
| 1120 Handle<Type> compare_type() { return compare_type_; } | 1125 Type* compare_type() { return compare_type_; } |
| 1121 void set_compare_type(Handle<Type> type) { compare_type_ = type; } | 1126 void set_compare_type(Type* type) { compare_type_ = type; } |
| 1122 | 1127 |
| 1123 private: | 1128 private: |
| 1124 CaseClause(Isolate* isolate, | 1129 CaseClause(Zone* zone, |
| 1125 Expression* label, | 1130 Expression* label, |
| 1126 ZoneList<Statement*>* statements, | 1131 ZoneList<Statement*>* statements, |
| 1127 int pos); | 1132 int pos); |
| 1128 | 1133 |
| 1129 Expression* label_; | 1134 Expression* label_; |
| 1130 Label body_target_; | 1135 Label body_target_; |
| 1131 ZoneList<Statement*>* statements_; | 1136 ZoneList<Statement*>* statements_; |
| 1132 Handle<Type> compare_type_; | 1137 Type* compare_type_; |
| 1133 | 1138 |
| 1134 const TypeFeedbackId compare_id_; | 1139 const TypeFeedbackId compare_id_; |
| 1135 const BailoutId entry_id_; | 1140 const BailoutId entry_id_; |
| 1136 }; | 1141 }; |
| 1137 | 1142 |
| 1138 | 1143 |
| 1139 class SwitchStatement V8_FINAL : public BreakableStatement { | 1144 class SwitchStatement V8_FINAL : public BreakableStatement { |
| 1140 public: | 1145 public: |
| 1141 DECLARE_NODE_TYPE(SwitchStatement) | 1146 DECLARE_NODE_TYPE(SwitchStatement) |
| 1142 | 1147 |
| 1143 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 1148 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { |
| 1144 tag_ = tag; | 1149 tag_ = tag; |
| 1145 cases_ = cases; | 1150 cases_ = cases; |
| 1146 } | 1151 } |
| 1147 | 1152 |
| 1148 Expression* tag() const { return tag_; } | 1153 Expression* tag() const { return tag_; } |
| 1149 ZoneList<CaseClause*>* cases() const { return cases_; } | 1154 ZoneList<CaseClause*>* cases() const { return cases_; } |
| 1150 | 1155 |
| 1151 protected: | 1156 protected: |
| 1152 SwitchStatement(Isolate* isolate, ZoneStringList* labels, int pos) | 1157 SwitchStatement(Zone* zone, ZoneStringList* labels, int pos) |
| 1153 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS, pos), | 1158 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), |
| 1154 tag_(NULL), | 1159 tag_(NULL), |
| 1155 cases_(NULL) { } | 1160 cases_(NULL) { } |
| 1156 | 1161 |
| 1157 private: | 1162 private: |
| 1158 Expression* tag_; | 1163 Expression* tag_; |
| 1159 ZoneList<CaseClause*>* cases_; | 1164 ZoneList<CaseClause*>* cases_; |
| 1160 }; | 1165 }; |
| 1161 | 1166 |
| 1162 | 1167 |
| 1163 // If-statements always have non-null references to their then- and | 1168 // If-statements always have non-null references to their then- and |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1179 virtual bool IsJump() const V8_OVERRIDE { | 1184 virtual bool IsJump() const V8_OVERRIDE { |
| 1180 return HasThenStatement() && then_statement()->IsJump() | 1185 return HasThenStatement() && then_statement()->IsJump() |
| 1181 && HasElseStatement() && else_statement()->IsJump(); | 1186 && HasElseStatement() && else_statement()->IsJump(); |
| 1182 } | 1187 } |
| 1183 | 1188 |
| 1184 BailoutId IfId() const { return if_id_; } | 1189 BailoutId IfId() const { return if_id_; } |
| 1185 BailoutId ThenId() const { return then_id_; } | 1190 BailoutId ThenId() const { return then_id_; } |
| 1186 BailoutId ElseId() const { return else_id_; } | 1191 BailoutId ElseId() const { return else_id_; } |
| 1187 | 1192 |
| 1188 protected: | 1193 protected: |
| 1189 IfStatement(Isolate* isolate, | 1194 IfStatement(Zone* zone, |
| 1190 Expression* condition, | 1195 Expression* condition, |
| 1191 Statement* then_statement, | 1196 Statement* then_statement, |
| 1192 Statement* else_statement, | 1197 Statement* else_statement, |
| 1193 int pos) | 1198 int pos) |
| 1194 : Statement(pos), | 1199 : Statement(zone, pos), |
| 1195 condition_(condition), | 1200 condition_(condition), |
| 1196 then_statement_(then_statement), | 1201 then_statement_(then_statement), |
| 1197 else_statement_(else_statement), | 1202 else_statement_(else_statement), |
| 1198 if_id_(GetNextId(isolate)), | 1203 if_id_(GetNextId(zone)), |
| 1199 then_id_(GetNextId(isolate)), | 1204 then_id_(GetNextId(zone)), |
| 1200 else_id_(GetNextId(isolate)) { | 1205 else_id_(GetNextId(zone)) { |
| 1201 } | 1206 } |
| 1202 | 1207 |
| 1203 private: | 1208 private: |
| 1204 Expression* condition_; | 1209 Expression* condition_; |
| 1205 Statement* then_statement_; | 1210 Statement* then_statement_; |
| 1206 Statement* else_statement_; | 1211 Statement* else_statement_; |
| 1207 const BailoutId if_id_; | 1212 const BailoutId if_id_; |
| 1208 const BailoutId then_id_; | 1213 const BailoutId then_id_; |
| 1209 const BailoutId else_id_; | 1214 const BailoutId else_id_; |
| 1210 }; | 1215 }; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1238 public: | 1243 public: |
| 1239 void set_escaping_targets(ZoneList<Label*>* targets) { | 1244 void set_escaping_targets(ZoneList<Label*>* targets) { |
| 1240 escaping_targets_ = targets; | 1245 escaping_targets_ = targets; |
| 1241 } | 1246 } |
| 1242 | 1247 |
| 1243 int index() const { return index_; } | 1248 int index() const { return index_; } |
| 1244 Block* try_block() const { return try_block_; } | 1249 Block* try_block() const { return try_block_; } |
| 1245 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; } | 1250 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; } |
| 1246 | 1251 |
| 1247 protected: | 1252 protected: |
| 1248 TryStatement(int index, Block* try_block, int pos) | 1253 TryStatement(Zone* zone, int index, Block* try_block, int pos) |
| 1249 : Statement(pos), | 1254 : Statement(zone, pos), |
| 1250 index_(index), | 1255 index_(index), |
| 1251 try_block_(try_block), | 1256 try_block_(try_block), |
| 1252 escaping_targets_(NULL) { } | 1257 escaping_targets_(NULL) { } |
| 1253 | 1258 |
| 1254 private: | 1259 private: |
| 1255 // Unique (per-function) index of this handler. This is not an AST ID. | 1260 // Unique (per-function) index of this handler. This is not an AST ID. |
| 1256 int index_; | 1261 int index_; |
| 1257 | 1262 |
| 1258 Block* try_block_; | 1263 Block* try_block_; |
| 1259 ZoneList<Label*>* escaping_targets_; | 1264 ZoneList<Label*>* escaping_targets_; |
| 1260 }; | 1265 }; |
| 1261 | 1266 |
| 1262 | 1267 |
| 1263 class TryCatchStatement V8_FINAL : public TryStatement { | 1268 class TryCatchStatement V8_FINAL : public TryStatement { |
| 1264 public: | 1269 public: |
| 1265 DECLARE_NODE_TYPE(TryCatchStatement) | 1270 DECLARE_NODE_TYPE(TryCatchStatement) |
| 1266 | 1271 |
| 1267 Scope* scope() { return scope_; } | 1272 Scope* scope() { return scope_; } |
| 1268 Variable* variable() { return variable_; } | 1273 Variable* variable() { return variable_; } |
| 1269 Block* catch_block() const { return catch_block_; } | 1274 Block* catch_block() const { return catch_block_; } |
| 1270 | 1275 |
| 1271 protected: | 1276 protected: |
| 1272 TryCatchStatement(int index, | 1277 TryCatchStatement(Zone* zone, |
| 1278 int index, |
| 1273 Block* try_block, | 1279 Block* try_block, |
| 1274 Scope* scope, | 1280 Scope* scope, |
| 1275 Variable* variable, | 1281 Variable* variable, |
| 1276 Block* catch_block, | 1282 Block* catch_block, |
| 1277 int pos) | 1283 int pos) |
| 1278 : TryStatement(index, try_block, pos), | 1284 : TryStatement(zone, index, try_block, pos), |
| 1279 scope_(scope), | 1285 scope_(scope), |
| 1280 variable_(variable), | 1286 variable_(variable), |
| 1281 catch_block_(catch_block) { | 1287 catch_block_(catch_block) { |
| 1282 } | 1288 } |
| 1283 | 1289 |
| 1284 private: | 1290 private: |
| 1285 Scope* scope_; | 1291 Scope* scope_; |
| 1286 Variable* variable_; | 1292 Variable* variable_; |
| 1287 Block* catch_block_; | 1293 Block* catch_block_; |
| 1288 }; | 1294 }; |
| 1289 | 1295 |
| 1290 | 1296 |
| 1291 class TryFinallyStatement V8_FINAL : public TryStatement { | 1297 class TryFinallyStatement V8_FINAL : public TryStatement { |
| 1292 public: | 1298 public: |
| 1293 DECLARE_NODE_TYPE(TryFinallyStatement) | 1299 DECLARE_NODE_TYPE(TryFinallyStatement) |
| 1294 | 1300 |
| 1295 Block* finally_block() const { return finally_block_; } | 1301 Block* finally_block() const { return finally_block_; } |
| 1296 | 1302 |
| 1297 protected: | 1303 protected: |
| 1298 TryFinallyStatement( | 1304 TryFinallyStatement( |
| 1299 int index, Block* try_block, Block* finally_block, int pos) | 1305 Zone* zone, int index, Block* try_block, Block* finally_block, int pos) |
| 1300 : TryStatement(index, try_block, pos), | 1306 : TryStatement(zone, index, try_block, pos), |
| 1301 finally_block_(finally_block) { } | 1307 finally_block_(finally_block) { } |
| 1302 | 1308 |
| 1303 private: | 1309 private: |
| 1304 Block* finally_block_; | 1310 Block* finally_block_; |
| 1305 }; | 1311 }; |
| 1306 | 1312 |
| 1307 | 1313 |
| 1308 class DebuggerStatement V8_FINAL : public Statement { | 1314 class DebuggerStatement V8_FINAL : public Statement { |
| 1309 public: | 1315 public: |
| 1310 DECLARE_NODE_TYPE(DebuggerStatement) | 1316 DECLARE_NODE_TYPE(DebuggerStatement) |
| 1311 | 1317 |
| 1312 protected: | 1318 protected: |
| 1313 explicit DebuggerStatement(int pos): Statement(pos) {} | 1319 explicit DebuggerStatement(Zone* zone, int pos): Statement(zone, pos) {} |
| 1314 }; | 1320 }; |
| 1315 | 1321 |
| 1316 | 1322 |
| 1317 class EmptyStatement V8_FINAL : public Statement { | 1323 class EmptyStatement V8_FINAL : public Statement { |
| 1318 public: | 1324 public: |
| 1319 DECLARE_NODE_TYPE(EmptyStatement) | 1325 DECLARE_NODE_TYPE(EmptyStatement) |
| 1320 | 1326 |
| 1321 protected: | 1327 protected: |
| 1322 explicit EmptyStatement(int pos): Statement(pos) {} | 1328 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {} |
| 1323 }; | 1329 }; |
| 1324 | 1330 |
| 1325 | 1331 |
| 1326 class Literal V8_FINAL : public Expression { | 1332 class Literal V8_FINAL : public Expression { |
| 1327 public: | 1333 public: |
| 1328 DECLARE_NODE_TYPE(Literal) | 1334 DECLARE_NODE_TYPE(Literal) |
| 1329 | 1335 |
| 1330 virtual bool IsPropertyName() V8_OVERRIDE { | 1336 virtual bool IsPropertyName() V8_OVERRIDE { |
| 1331 if (value_->IsInternalizedString()) { | 1337 if (value_->IsInternalizedString()) { |
| 1332 uint32_t ignored; | 1338 uint32_t ignored; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 | 1375 |
| 1370 static bool Match(void* literal1, void* literal2) { | 1376 static bool Match(void* literal1, void* literal2) { |
| 1371 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); | 1377 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); |
| 1372 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); | 1378 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); |
| 1373 return s1->Equals(*s2); | 1379 return s1->Equals(*s2); |
| 1374 } | 1380 } |
| 1375 | 1381 |
| 1376 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } | 1382 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } |
| 1377 | 1383 |
| 1378 protected: | 1384 protected: |
| 1379 Literal( | 1385 Literal(Zone* zone, Handle<Object> value, int position) |
| 1380 Isolate* isolate, Handle<Object> value, int position) | 1386 : Expression(zone, position), |
| 1381 : Expression(isolate, position), | |
| 1382 value_(value), | 1387 value_(value), |
| 1383 isolate_(isolate) { } | 1388 isolate_(zone->isolate()) { } |
| 1384 | 1389 |
| 1385 private: | 1390 private: |
| 1386 Handle<String> ToString(); | 1391 Handle<String> ToString(); |
| 1387 | 1392 |
| 1388 Handle<Object> value_; | 1393 Handle<Object> value_; |
| 1389 // TODO(dcarney): remove. this is only needed for Match and Hash. | 1394 // TODO(dcarney): remove. this is only needed for Match and Hash. |
| 1390 Isolate* isolate_; | 1395 Isolate* isolate_; |
| 1391 }; | 1396 }; |
| 1392 | 1397 |
| 1393 | 1398 |
| 1394 // Base class for literals that needs space in the corresponding JSFunction. | 1399 // Base class for literals that needs space in the corresponding JSFunction. |
| 1395 class MaterializedLiteral : public Expression { | 1400 class MaterializedLiteral : public Expression { |
| 1396 public: | 1401 public: |
| 1397 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } | 1402 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } |
| 1398 | 1403 |
| 1399 int literal_index() { return literal_index_; } | 1404 int literal_index() { return literal_index_; } |
| 1400 | 1405 |
| 1401 int depth() const { | 1406 int depth() const { |
| 1402 // only callable after initialization. | 1407 // only callable after initialization. |
| 1403 ASSERT(depth_ >= 1); | 1408 ASSERT(depth_ >= 1); |
| 1404 return depth_; | 1409 return depth_; |
| 1405 } | 1410 } |
| 1406 | 1411 |
| 1407 protected: | 1412 protected: |
| 1408 MaterializedLiteral(Isolate* isolate, | 1413 MaterializedLiteral(Zone* zone, |
| 1409 int literal_index, | 1414 int literal_index, |
| 1410 int pos) | 1415 int pos) |
| 1411 : Expression(isolate, pos), | 1416 : Expression(zone, pos), |
| 1412 literal_index_(literal_index), | 1417 literal_index_(literal_index), |
| 1413 is_simple_(false), | 1418 is_simple_(false), |
| 1414 depth_(0) {} | 1419 depth_(0) {} |
| 1415 | 1420 |
| 1416 // A materialized literal is simple if the values consist of only | 1421 // A materialized literal is simple if the values consist of only |
| 1417 // constants and simple object and array literals. | 1422 // constants and simple object and array literals. |
| 1418 bool is_simple() const { return is_simple_; } | 1423 bool is_simple() const { return is_simple_; } |
| 1419 void set_is_simple(bool is_simple) { is_simple_ = is_simple; } | 1424 void set_is_simple(bool is_simple) { is_simple_ = is_simple; } |
| 1420 friend class CompileTimeValue; | 1425 friend class CompileTimeValue; |
| 1421 | 1426 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1449 class ObjectLiteralProperty V8_FINAL : public ZoneObject { | 1454 class ObjectLiteralProperty V8_FINAL : public ZoneObject { |
| 1450 public: | 1455 public: |
| 1451 enum Kind { | 1456 enum Kind { |
| 1452 CONSTANT, // Property with constant value (compile time). | 1457 CONSTANT, // Property with constant value (compile time). |
| 1453 COMPUTED, // Property with computed value (execution time). | 1458 COMPUTED, // Property with computed value (execution time). |
| 1454 MATERIALIZED_LITERAL, // Property value is a materialized literal. | 1459 MATERIALIZED_LITERAL, // Property value is a materialized literal. |
| 1455 GETTER, SETTER, // Property is an accessor function. | 1460 GETTER, SETTER, // Property is an accessor function. |
| 1456 PROTOTYPE // Property is __proto__. | 1461 PROTOTYPE // Property is __proto__. |
| 1457 }; | 1462 }; |
| 1458 | 1463 |
| 1459 ObjectLiteralProperty(Literal* key, Expression* value, Isolate* isolate); | 1464 ObjectLiteralProperty(Zone* zone, Literal* key, Expression* value); |
| 1460 | 1465 |
| 1461 Literal* key() { return key_; } | 1466 Literal* key() { return key_; } |
| 1462 Expression* value() { return value_; } | 1467 Expression* value() { return value_; } |
| 1463 Kind kind() { return kind_; } | 1468 Kind kind() { return kind_; } |
| 1464 | 1469 |
| 1465 // Type feedback information. | 1470 // Type feedback information. |
| 1466 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1471 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1467 bool IsMonomorphic() { return !receiver_type_.is_null(); } | 1472 bool IsMonomorphic() { return !receiver_type_.is_null(); } |
| 1468 Handle<Map> GetReceiverType() { return receiver_type_; } | 1473 Handle<Map> GetReceiverType() { return receiver_type_; } |
| 1469 | 1474 |
| 1470 bool IsCompileTimeValue(); | 1475 bool IsCompileTimeValue(); |
| 1471 | 1476 |
| 1472 void set_emit_store(bool emit_store); | 1477 void set_emit_store(bool emit_store); |
| 1473 bool emit_store(); | 1478 bool emit_store(); |
| 1474 | 1479 |
| 1475 protected: | 1480 protected: |
| 1476 template<class> friend class AstNodeFactory; | 1481 template<class> friend class AstNodeFactory; |
| 1477 | 1482 |
| 1478 ObjectLiteralProperty(bool is_getter, FunctionLiteral* value); | 1483 ObjectLiteralProperty(Zone* zone, bool is_getter, FunctionLiteral* value); |
| 1479 void set_key(Literal* key) { key_ = key; } | 1484 void set_key(Literal* key) { key_ = key; } |
| 1480 | 1485 |
| 1481 private: | 1486 private: |
| 1482 Literal* key_; | 1487 Literal* key_; |
| 1483 Expression* value_; | 1488 Expression* value_; |
| 1484 Kind kind_; | 1489 Kind kind_; |
| 1485 bool emit_store_; | 1490 bool emit_store_; |
| 1486 Handle<Map> receiver_type_; | 1491 Handle<Map> receiver_type_; |
| 1487 }; | 1492 }; |
| 1488 | 1493 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1520 kHasFunction = 1 << 1 | 1525 kHasFunction = 1 << 1 |
| 1521 }; | 1526 }; |
| 1522 | 1527 |
| 1523 struct Accessors: public ZoneObject { | 1528 struct Accessors: public ZoneObject { |
| 1524 Accessors() : getter(NULL), setter(NULL) { } | 1529 Accessors() : getter(NULL), setter(NULL) { } |
| 1525 Expression* getter; | 1530 Expression* getter; |
| 1526 Expression* setter; | 1531 Expression* setter; |
| 1527 }; | 1532 }; |
| 1528 | 1533 |
| 1529 protected: | 1534 protected: |
| 1530 ObjectLiteral(Isolate* isolate, | 1535 ObjectLiteral(Zone* zone, |
| 1531 ZoneList<Property*>* properties, | 1536 ZoneList<Property*>* properties, |
| 1532 int literal_index, | 1537 int literal_index, |
| 1533 int boilerplate_properties, | 1538 int boilerplate_properties, |
| 1534 bool has_function, | 1539 bool has_function, |
| 1535 int pos) | 1540 int pos) |
| 1536 : MaterializedLiteral(isolate, literal_index, pos), | 1541 : MaterializedLiteral(zone, literal_index, pos), |
| 1537 properties_(properties), | 1542 properties_(properties), |
| 1538 boilerplate_properties_(boilerplate_properties), | 1543 boilerplate_properties_(boilerplate_properties), |
| 1539 fast_elements_(false), | 1544 fast_elements_(false), |
| 1540 may_store_doubles_(false), | 1545 may_store_doubles_(false), |
| 1541 has_function_(has_function) {} | 1546 has_function_(has_function) {} |
| 1542 | 1547 |
| 1543 private: | 1548 private: |
| 1544 Handle<FixedArray> constant_properties_; | 1549 Handle<FixedArray> constant_properties_; |
| 1545 ZoneList<Property*>* properties_; | 1550 ZoneList<Property*>* properties_; |
| 1546 int boilerplate_properties_; | 1551 int boilerplate_properties_; |
| 1547 bool fast_elements_; | 1552 bool fast_elements_; |
| 1548 bool may_store_doubles_; | 1553 bool may_store_doubles_; |
| 1549 bool has_function_; | 1554 bool has_function_; |
| 1550 }; | 1555 }; |
| 1551 | 1556 |
| 1552 | 1557 |
| 1553 // Node for capturing a regexp literal. | 1558 // Node for capturing a regexp literal. |
| 1554 class RegExpLiteral V8_FINAL : public MaterializedLiteral { | 1559 class RegExpLiteral V8_FINAL : public MaterializedLiteral { |
| 1555 public: | 1560 public: |
| 1556 DECLARE_NODE_TYPE(RegExpLiteral) | 1561 DECLARE_NODE_TYPE(RegExpLiteral) |
| 1557 | 1562 |
| 1558 Handle<String> pattern() const { return pattern_; } | 1563 Handle<String> pattern() const { return pattern_; } |
| 1559 Handle<String> flags() const { return flags_; } | 1564 Handle<String> flags() const { return flags_; } |
| 1560 | 1565 |
| 1561 protected: | 1566 protected: |
| 1562 RegExpLiteral(Isolate* isolate, | 1567 RegExpLiteral(Zone* zone, |
| 1563 Handle<String> pattern, | 1568 Handle<String> pattern, |
| 1564 Handle<String> flags, | 1569 Handle<String> flags, |
| 1565 int literal_index, | 1570 int literal_index, |
| 1566 int pos) | 1571 int pos) |
| 1567 : MaterializedLiteral(isolate, literal_index, pos), | 1572 : MaterializedLiteral(zone, literal_index, pos), |
| 1568 pattern_(pattern), | 1573 pattern_(pattern), |
| 1569 flags_(flags) { | 1574 flags_(flags) { |
| 1570 set_depth(1); | 1575 set_depth(1); |
| 1571 } | 1576 } |
| 1572 | 1577 |
| 1573 private: | 1578 private: |
| 1574 Handle<String> pattern_; | 1579 Handle<String> pattern_; |
| 1575 Handle<String> flags_; | 1580 Handle<String> flags_; |
| 1576 }; | 1581 }; |
| 1577 | 1582 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1593 // Populate the constant elements fixed array. | 1598 // Populate the constant elements fixed array. |
| 1594 void BuildConstantElements(Isolate* isolate); | 1599 void BuildConstantElements(Isolate* isolate); |
| 1595 | 1600 |
| 1596 enum Flags { | 1601 enum Flags { |
| 1597 kNoFlags = 0, | 1602 kNoFlags = 0, |
| 1598 kShallowElements = 1, | 1603 kShallowElements = 1, |
| 1599 kDisableMementos = 1 << 1 | 1604 kDisableMementos = 1 << 1 |
| 1600 }; | 1605 }; |
| 1601 | 1606 |
| 1602 protected: | 1607 protected: |
| 1603 ArrayLiteral(Isolate* isolate, | 1608 ArrayLiteral(Zone* zone, |
| 1604 ZoneList<Expression*>* values, | 1609 ZoneList<Expression*>* values, |
| 1605 int literal_index, | 1610 int literal_index, |
| 1606 int pos) | 1611 int pos) |
| 1607 : MaterializedLiteral(isolate, literal_index, pos), | 1612 : MaterializedLiteral(zone, literal_index, pos), |
| 1608 values_(values), | 1613 values_(values), |
| 1609 first_element_id_(ReserveIdRange(isolate, values->length())) {} | 1614 first_element_id_(ReserveIdRange(zone, values->length())) {} |
| 1610 | 1615 |
| 1611 private: | 1616 private: |
| 1612 Handle<FixedArray> constant_elements_; | 1617 Handle<FixedArray> constant_elements_; |
| 1613 ZoneList<Expression*>* values_; | 1618 ZoneList<Expression*>* values_; |
| 1614 const BailoutId first_element_id_; | 1619 const BailoutId first_element_id_; |
| 1615 }; | 1620 }; |
| 1616 | 1621 |
| 1617 | 1622 |
| 1618 class VariableProxy V8_FINAL : public Expression { | 1623 class VariableProxy V8_FINAL : public Expression { |
| 1619 public: | 1624 public: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1639 Interface* interface() const { return interface_; } | 1644 Interface* interface() const { return interface_; } |
| 1640 | 1645 |
| 1641 | 1646 |
| 1642 void MarkAsTrivial() { is_trivial_ = true; } | 1647 void MarkAsTrivial() { is_trivial_ = true; } |
| 1643 void MarkAsLValue() { is_lvalue_ = true; } | 1648 void MarkAsLValue() { is_lvalue_ = true; } |
| 1644 | 1649 |
| 1645 // Bind this proxy to the variable var. Interfaces must match. | 1650 // Bind this proxy to the variable var. Interfaces must match. |
| 1646 void BindTo(Variable* var); | 1651 void BindTo(Variable* var); |
| 1647 | 1652 |
| 1648 protected: | 1653 protected: |
| 1649 VariableProxy(Isolate* isolate, Variable* var, int position); | 1654 VariableProxy(Zone* zone, Variable* var, int position); |
| 1650 | 1655 |
| 1651 VariableProxy(Isolate* isolate, | 1656 VariableProxy(Zone* zone, |
| 1652 Handle<String> name, | 1657 Handle<String> name, |
| 1653 bool is_this, | 1658 bool is_this, |
| 1654 Interface* interface, | 1659 Interface* interface, |
| 1655 int position); | 1660 int position); |
| 1656 | 1661 |
| 1657 Handle<String> name_; | 1662 Handle<String> name_; |
| 1658 Variable* var_; // resolved variable, or NULL | 1663 Variable* var_; // resolved variable, or NULL |
| 1659 bool is_this_; | 1664 bool is_this_; |
| 1660 bool is_trivial_; | 1665 bool is_trivial_; |
| 1661 // True if this variable proxy is being used in an assignment | 1666 // True if this variable proxy is being used in an assignment |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1695 return is_uninitialized_ || is_pre_monomorphic_; | 1700 return is_uninitialized_ || is_pre_monomorphic_; |
| 1696 } | 1701 } |
| 1697 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } | 1702 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } |
| 1698 void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; } | 1703 void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; } |
| 1699 void set_is_string_access(bool b) { is_string_access_ = b; } | 1704 void set_is_string_access(bool b) { is_string_access_ = b; } |
| 1700 void set_is_function_prototype(bool b) { is_function_prototype_ = b; } | 1705 void set_is_function_prototype(bool b) { is_function_prototype_ = b; } |
| 1701 | 1706 |
| 1702 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } | 1707 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } |
| 1703 | 1708 |
| 1704 protected: | 1709 protected: |
| 1705 Property(Isolate* isolate, | 1710 Property(Zone* zone, |
| 1706 Expression* obj, | 1711 Expression* obj, |
| 1707 Expression* key, | 1712 Expression* key, |
| 1708 int pos) | 1713 int pos) |
| 1709 : Expression(isolate, pos), | 1714 : Expression(zone, pos), |
| 1710 obj_(obj), | 1715 obj_(obj), |
| 1711 key_(key), | 1716 key_(key), |
| 1712 load_id_(GetNextId(isolate)), | 1717 load_id_(GetNextId(zone)), |
| 1713 is_pre_monomorphic_(false), | 1718 is_pre_monomorphic_(false), |
| 1714 is_uninitialized_(false), | 1719 is_uninitialized_(false), |
| 1715 is_string_access_(false), | 1720 is_string_access_(false), |
| 1716 is_function_prototype_(false) { } | 1721 is_function_prototype_(false) { } |
| 1717 | 1722 |
| 1718 private: | 1723 private: |
| 1719 Expression* obj_; | 1724 Expression* obj_; |
| 1720 Expression* key_; | 1725 Expression* key_; |
| 1721 const BailoutId load_id_; | 1726 const BailoutId load_id_; |
| 1722 | 1727 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 // as the holder! | 1772 // as the holder! |
| 1768 Handle<JSObject> holder() { return holder_; } | 1773 Handle<JSObject> holder() { return holder_; } |
| 1769 | 1774 |
| 1770 Handle<Cell> cell() { return cell_; } | 1775 Handle<Cell> cell() { return cell_; } |
| 1771 | 1776 |
| 1772 bool ComputeTarget(Handle<Map> type, Handle<String> name); | 1777 bool ComputeTarget(Handle<Map> type, Handle<String> name); |
| 1773 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupResult* lookup); | 1778 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupResult* lookup); |
| 1774 | 1779 |
| 1775 BailoutId ReturnId() const { return return_id_; } | 1780 BailoutId ReturnId() const { return return_id_; } |
| 1776 | 1781 |
| 1782 enum CallType { |
| 1783 POSSIBLY_EVAL_CALL, |
| 1784 GLOBAL_CALL, |
| 1785 LOOKUP_SLOT_CALL, |
| 1786 PROPERTY_CALL, |
| 1787 OTHER_CALL |
| 1788 }; |
| 1789 |
| 1790 // Helpers to determine how to handle the call. |
| 1791 CallType GetCallType(Isolate* isolate) const; |
| 1792 |
| 1777 // TODO(rossberg): this should really move somewhere else (and be merged with | 1793 // TODO(rossberg): this should really move somewhere else (and be merged with |
| 1778 // various similar methods in objets.cc), but for now... | 1794 // various similar methods in objets.cc), but for now... |
| 1779 static Handle<JSObject> GetPrototypeForPrimitiveCheck( | 1795 static Handle<JSObject> GetPrototypeForPrimitiveCheck( |
| 1780 CheckType check, Isolate* isolate); | 1796 CheckType check, Isolate* isolate); |
| 1781 | 1797 |
| 1782 #ifdef DEBUG | 1798 #ifdef DEBUG |
| 1783 // Used to assert that the FullCodeGenerator records the return site. | 1799 // Used to assert that the FullCodeGenerator records the return site. |
| 1784 bool return_is_recorded_; | 1800 bool return_is_recorded_; |
| 1785 #endif | 1801 #endif |
| 1786 | 1802 |
| 1787 protected: | 1803 protected: |
| 1788 Call(Isolate* isolate, | 1804 Call(Zone* zone, |
| 1789 Expression* expression, | 1805 Expression* expression, |
| 1790 ZoneList<Expression*>* arguments, | 1806 ZoneList<Expression*>* arguments, |
| 1791 int pos) | 1807 int pos) |
| 1792 : Expression(isolate, pos), | 1808 : Expression(zone, pos), |
| 1793 expression_(expression), | 1809 expression_(expression), |
| 1794 arguments_(arguments), | 1810 arguments_(arguments), |
| 1795 is_monomorphic_(false), | 1811 is_monomorphic_(false), |
| 1796 keyed_array_call_is_holey_(true), | 1812 keyed_array_call_is_holey_(true), |
| 1797 check_type_(RECEIVER_MAP_CHECK), | 1813 check_type_(RECEIVER_MAP_CHECK), |
| 1798 return_id_(GetNextId(isolate)) { } | 1814 return_id_(GetNextId(zone)) { } |
| 1799 | 1815 |
| 1800 private: | 1816 private: |
| 1801 Expression* expression_; | 1817 Expression* expression_; |
| 1802 ZoneList<Expression*>* arguments_; | 1818 ZoneList<Expression*>* arguments_; |
| 1803 | 1819 |
| 1804 bool is_monomorphic_; | 1820 bool is_monomorphic_; |
| 1805 bool keyed_array_call_is_holey_; | 1821 bool keyed_array_call_is_holey_; |
| 1806 CheckType check_type_; | 1822 CheckType check_type_; |
| 1807 SmallMapList receiver_types_; | 1823 SmallMapList receiver_types_; |
| 1808 Handle<JSFunction> target_; | 1824 Handle<JSFunction> target_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1819 | 1835 |
| 1820 Expression* expression() const { return expression_; } | 1836 Expression* expression() const { return expression_; } |
| 1821 ZoneList<Expression*>* arguments() const { return arguments_; } | 1837 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1822 | 1838 |
| 1823 // Type feedback information. | 1839 // Type feedback information. |
| 1824 TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); } | 1840 TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); } |
| 1825 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1841 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1826 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } | 1842 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
| 1827 Handle<JSFunction> target() const { return target_; } | 1843 Handle<JSFunction> target() const { return target_; } |
| 1828 ElementsKind elements_kind() const { return elements_kind_; } | 1844 ElementsKind elements_kind() const { return elements_kind_; } |
| 1829 Handle<Cell> allocation_info_cell() const { | 1845 Handle<AllocationSite> allocation_site() const { |
| 1830 return allocation_info_cell_; | 1846 return allocation_site_; |
| 1831 } | 1847 } |
| 1832 | 1848 |
| 1833 BailoutId ReturnId() const { return return_id_; } | 1849 BailoutId ReturnId() const { return return_id_; } |
| 1834 | 1850 |
| 1835 protected: | 1851 protected: |
| 1836 CallNew(Isolate* isolate, | 1852 CallNew(Zone* zone, |
| 1837 Expression* expression, | 1853 Expression* expression, |
| 1838 ZoneList<Expression*>* arguments, | 1854 ZoneList<Expression*>* arguments, |
| 1839 int pos) | 1855 int pos) |
| 1840 : Expression(isolate, pos), | 1856 : Expression(zone, pos), |
| 1841 expression_(expression), | 1857 expression_(expression), |
| 1842 arguments_(arguments), | 1858 arguments_(arguments), |
| 1843 is_monomorphic_(false), | 1859 is_monomorphic_(false), |
| 1844 elements_kind_(GetInitialFastElementsKind()), | 1860 elements_kind_(GetInitialFastElementsKind()), |
| 1845 return_id_(GetNextId(isolate)) { } | 1861 return_id_(GetNextId(zone)) { } |
| 1846 | 1862 |
| 1847 private: | 1863 private: |
| 1848 Expression* expression_; | 1864 Expression* expression_; |
| 1849 ZoneList<Expression*>* arguments_; | 1865 ZoneList<Expression*>* arguments_; |
| 1850 | 1866 |
| 1851 bool is_monomorphic_; | 1867 bool is_monomorphic_; |
| 1852 Handle<JSFunction> target_; | 1868 Handle<JSFunction> target_; |
| 1853 ElementsKind elements_kind_; | 1869 ElementsKind elements_kind_; |
| 1854 Handle<Cell> allocation_info_cell_; | 1870 Handle<AllocationSite> allocation_site_; |
| 1855 | 1871 |
| 1856 const BailoutId return_id_; | 1872 const BailoutId return_id_; |
| 1857 }; | 1873 }; |
| 1858 | 1874 |
| 1859 | 1875 |
| 1860 // The CallRuntime class does not represent any official JavaScript | 1876 // The CallRuntime class does not represent any official JavaScript |
| 1861 // language construct. Instead it is used to call a C or JS function | 1877 // language construct. Instead it is used to call a C or JS function |
| 1862 // with a set of arguments. This is used from the builtins that are | 1878 // with a set of arguments. This is used from the builtins that are |
| 1863 // implemented in JavaScript (see "v8natives.js"). | 1879 // implemented in JavaScript (see "v8natives.js"). |
| 1864 class CallRuntime V8_FINAL : public Expression { | 1880 class CallRuntime V8_FINAL : public Expression { |
| 1865 public: | 1881 public: |
| 1866 DECLARE_NODE_TYPE(CallRuntime) | 1882 DECLARE_NODE_TYPE(CallRuntime) |
| 1867 | 1883 |
| 1868 Handle<String> name() const { return name_; } | 1884 Handle<String> name() const { return name_; } |
| 1869 const Runtime::Function* function() const { return function_; } | 1885 const Runtime::Function* function() const { return function_; } |
| 1870 ZoneList<Expression*>* arguments() const { return arguments_; } | 1886 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1871 bool is_jsruntime() const { return function_ == NULL; } | 1887 bool is_jsruntime() const { return function_ == NULL; } |
| 1872 | 1888 |
| 1873 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } | 1889 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } |
| 1874 | 1890 |
| 1875 protected: | 1891 protected: |
| 1876 CallRuntime(Isolate* isolate, | 1892 CallRuntime(Zone* zone, |
| 1877 Handle<String> name, | 1893 Handle<String> name, |
| 1878 const Runtime::Function* function, | 1894 const Runtime::Function* function, |
| 1879 ZoneList<Expression*>* arguments, | 1895 ZoneList<Expression*>* arguments, |
| 1880 int pos) | 1896 int pos) |
| 1881 : Expression(isolate, pos), | 1897 : Expression(zone, pos), |
| 1882 name_(name), | 1898 name_(name), |
| 1883 function_(function), | 1899 function_(function), |
| 1884 arguments_(arguments) { } | 1900 arguments_(arguments) { } |
| 1885 | 1901 |
| 1886 private: | 1902 private: |
| 1887 Handle<String> name_; | 1903 Handle<String> name_; |
| 1888 const Runtime::Function* function_; | 1904 const Runtime::Function* function_; |
| 1889 ZoneList<Expression*>* arguments_; | 1905 ZoneList<Expression*>* arguments_; |
| 1890 }; | 1906 }; |
| 1891 | 1907 |
| 1892 | 1908 |
| 1893 class UnaryOperation V8_FINAL : public Expression { | 1909 class UnaryOperation V8_FINAL : public Expression { |
| 1894 public: | 1910 public: |
| 1895 DECLARE_NODE_TYPE(UnaryOperation) | 1911 DECLARE_NODE_TYPE(UnaryOperation) |
| 1896 | 1912 |
| 1897 Token::Value op() const { return op_; } | 1913 Token::Value op() const { return op_; } |
| 1898 Expression* expression() const { return expression_; } | 1914 Expression* expression() const { return expression_; } |
| 1899 | 1915 |
| 1900 BailoutId MaterializeTrueId() { return materialize_true_id_; } | 1916 BailoutId MaterializeTrueId() { return materialize_true_id_; } |
| 1901 BailoutId MaterializeFalseId() { return materialize_false_id_; } | 1917 BailoutId MaterializeFalseId() { return materialize_false_id_; } |
| 1902 | 1918 |
| 1903 virtual void RecordToBooleanTypeFeedback( | 1919 virtual void RecordToBooleanTypeFeedback( |
| 1904 TypeFeedbackOracle* oracle) V8_OVERRIDE; | 1920 TypeFeedbackOracle* oracle) V8_OVERRIDE; |
| 1905 | 1921 |
| 1906 protected: | 1922 protected: |
| 1907 UnaryOperation(Isolate* isolate, | 1923 UnaryOperation(Zone* zone, |
| 1908 Token::Value op, | 1924 Token::Value op, |
| 1909 Expression* expression, | 1925 Expression* expression, |
| 1910 int pos) | 1926 int pos) |
| 1911 : Expression(isolate, pos), | 1927 : Expression(zone, pos), |
| 1912 op_(op), | 1928 op_(op), |
| 1913 expression_(expression), | 1929 expression_(expression), |
| 1914 materialize_true_id_(GetNextId(isolate)), | 1930 materialize_true_id_(GetNextId(zone)), |
| 1915 materialize_false_id_(GetNextId(isolate)) { | 1931 materialize_false_id_(GetNextId(zone)) { |
| 1916 ASSERT(Token::IsUnaryOp(op)); | 1932 ASSERT(Token::IsUnaryOp(op)); |
| 1917 } | 1933 } |
| 1918 | 1934 |
| 1919 private: | 1935 private: |
| 1920 Token::Value op_; | 1936 Token::Value op_; |
| 1921 Expression* expression_; | 1937 Expression* expression_; |
| 1922 | 1938 |
| 1923 // For unary not (Token::NOT), the AST ids where true and false will | 1939 // For unary not (Token::NOT), the AST ids where true and false will |
| 1924 // actually be materialized, respectively. | 1940 // actually be materialized, respectively. |
| 1925 const BailoutId materialize_true_id_; | 1941 const BailoutId materialize_true_id_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1944 BailoutId RightId() const { return right_id_; } | 1960 BailoutId RightId() const { return right_id_; } |
| 1945 | 1961 |
| 1946 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } | 1962 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } |
| 1947 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } | 1963 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } |
| 1948 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; } | 1964 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; } |
| 1949 | 1965 |
| 1950 virtual void RecordToBooleanTypeFeedback( | 1966 virtual void RecordToBooleanTypeFeedback( |
| 1951 TypeFeedbackOracle* oracle) V8_OVERRIDE; | 1967 TypeFeedbackOracle* oracle) V8_OVERRIDE; |
| 1952 | 1968 |
| 1953 protected: | 1969 protected: |
| 1954 BinaryOperation(Isolate* isolate, | 1970 BinaryOperation(Zone* zone, |
| 1955 Token::Value op, | 1971 Token::Value op, |
| 1956 Expression* left, | 1972 Expression* left, |
| 1957 Expression* right, | 1973 Expression* right, |
| 1958 int pos) | 1974 int pos) |
| 1959 : Expression(isolate, pos), | 1975 : Expression(zone, pos), |
| 1960 op_(op), | 1976 op_(op), |
| 1961 left_(left), | 1977 left_(left), |
| 1962 right_(right), | 1978 right_(right), |
| 1963 right_id_(GetNextId(isolate)) { | 1979 right_id_(GetNextId(zone)) { |
| 1964 ASSERT(Token::IsBinaryOp(op)); | 1980 ASSERT(Token::IsBinaryOp(op)); |
| 1965 } | 1981 } |
| 1966 | 1982 |
| 1967 private: | 1983 private: |
| 1968 Token::Value op_; | 1984 Token::Value op_; |
| 1969 Expression* left_; | 1985 Expression* left_; |
| 1970 Expression* right_; | 1986 Expression* right_; |
| 1971 Handle<AllocationSite> allocation_site_; | 1987 Handle<AllocationSite> allocation_site_; |
| 1972 | 1988 |
| 1973 // TODO(rossberg): the fixed arg should probably be represented as a Constant | 1989 // TODO(rossberg): the fixed arg should probably be represented as a Constant |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1996 | 2012 |
| 1997 virtual bool IsMonomorphic() V8_OVERRIDE { | 2013 virtual bool IsMonomorphic() V8_OVERRIDE { |
| 1998 return receiver_types_.length() == 1; | 2014 return receiver_types_.length() == 1; |
| 1999 } | 2015 } |
| 2000 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { | 2016 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { |
| 2001 return &receiver_types_; | 2017 return &receiver_types_; |
| 2002 } | 2018 } |
| 2003 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { | 2019 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { |
| 2004 return store_mode_; | 2020 return store_mode_; |
| 2005 } | 2021 } |
| 2006 Handle<Type> type() const { return type_; } | 2022 Type* type() const { return type_; } |
| 2007 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } | 2023 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } |
| 2008 void set_type(Handle<Type> type) { type_ = type; } | 2024 void set_type(Type* type) { type_ = type; } |
| 2009 | 2025 |
| 2010 BailoutId AssignmentId() const { return assignment_id_; } | 2026 BailoutId AssignmentId() const { return assignment_id_; } |
| 2011 | 2027 |
| 2012 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } | 2028 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } |
| 2013 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } | 2029 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } |
| 2014 | 2030 |
| 2015 protected: | 2031 protected: |
| 2016 CountOperation(Isolate* isolate, | 2032 CountOperation(Zone* zone, |
| 2017 Token::Value op, | 2033 Token::Value op, |
| 2018 bool is_prefix, | 2034 bool is_prefix, |
| 2019 Expression* expr, | 2035 Expression* expr, |
| 2020 int pos) | 2036 int pos) |
| 2021 : Expression(isolate, pos), | 2037 : Expression(zone, pos), |
| 2022 op_(op), | 2038 op_(op), |
| 2023 is_prefix_(is_prefix), | 2039 is_prefix_(is_prefix), |
| 2024 store_mode_(STANDARD_STORE), | 2040 store_mode_(STANDARD_STORE), |
| 2025 expression_(expr), | 2041 expression_(expr), |
| 2026 assignment_id_(GetNextId(isolate)), | 2042 assignment_id_(GetNextId(zone)), |
| 2027 count_id_(GetNextId(isolate)) {} | 2043 count_id_(GetNextId(zone)) {} |
| 2028 | 2044 |
| 2029 private: | 2045 private: |
| 2030 Token::Value op_; | 2046 Token::Value op_; |
| 2031 bool is_prefix_ : 1; | 2047 bool is_prefix_ : 1; |
| 2032 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, | 2048 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, |
| 2033 // must have extra bit. | 2049 // must have extra bit. |
| 2034 Handle<Type> type_; | 2050 Type* type_; |
| 2035 | 2051 |
| 2036 Expression* expression_; | 2052 Expression* expression_; |
| 2037 const BailoutId assignment_id_; | 2053 const BailoutId assignment_id_; |
| 2038 const TypeFeedbackId count_id_; | 2054 const TypeFeedbackId count_id_; |
| 2039 SmallMapList receiver_types_; | 2055 SmallMapList receiver_types_; |
| 2040 }; | 2056 }; |
| 2041 | 2057 |
| 2042 | 2058 |
| 2043 class CompareOperation V8_FINAL : public Expression { | 2059 class CompareOperation V8_FINAL : public Expression { |
| 2044 public: | 2060 public: |
| 2045 DECLARE_NODE_TYPE(CompareOperation) | 2061 DECLARE_NODE_TYPE(CompareOperation) |
| 2046 | 2062 |
| 2047 Token::Value op() const { return op_; } | 2063 Token::Value op() const { return op_; } |
| 2048 Expression* left() const { return left_; } | 2064 Expression* left() const { return left_; } |
| 2049 Expression* right() const { return right_; } | 2065 Expression* right() const { return right_; } |
| 2050 | 2066 |
| 2051 // Type feedback information. | 2067 // Type feedback information. |
| 2052 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } | 2068 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } |
| 2053 Handle<Type> combined_type() const { return combined_type_; } | 2069 Type* combined_type() const { return combined_type_; } |
| 2054 void set_combined_type(Handle<Type> type) { combined_type_ = type; } | 2070 void set_combined_type(Type* type) { combined_type_ = type; } |
| 2055 | 2071 |
| 2056 // Match special cases. | 2072 // Match special cases. |
| 2057 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); | 2073 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); |
| 2058 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate); | 2074 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate); |
| 2059 bool IsLiteralCompareNull(Expression** expr); | 2075 bool IsLiteralCompareNull(Expression** expr); |
| 2060 | 2076 |
| 2061 protected: | 2077 protected: |
| 2062 CompareOperation(Isolate* isolate, | 2078 CompareOperation(Zone* zone, |
| 2063 Token::Value op, | 2079 Token::Value op, |
| 2064 Expression* left, | 2080 Expression* left, |
| 2065 Expression* right, | 2081 Expression* right, |
| 2066 int pos) | 2082 int pos) |
| 2067 : Expression(isolate, pos), | 2083 : Expression(zone, pos), |
| 2068 op_(op), | 2084 op_(op), |
| 2069 left_(left), | 2085 left_(left), |
| 2070 right_(right), | 2086 right_(right), |
| 2071 combined_type_(Type::None(isolate)) { | 2087 combined_type_(Type::None(zone)) { |
| 2072 ASSERT(Token::IsCompareOp(op)); | 2088 ASSERT(Token::IsCompareOp(op)); |
| 2073 } | 2089 } |
| 2074 | 2090 |
| 2075 private: | 2091 private: |
| 2076 Token::Value op_; | 2092 Token::Value op_; |
| 2077 Expression* left_; | 2093 Expression* left_; |
| 2078 Expression* right_; | 2094 Expression* right_; |
| 2079 | 2095 |
| 2080 Handle<Type> combined_type_; | 2096 Type* combined_type_; |
| 2081 }; | 2097 }; |
| 2082 | 2098 |
| 2083 | 2099 |
| 2084 class Conditional V8_FINAL : public Expression { | 2100 class Conditional V8_FINAL : public Expression { |
| 2085 public: | 2101 public: |
| 2086 DECLARE_NODE_TYPE(Conditional) | 2102 DECLARE_NODE_TYPE(Conditional) |
| 2087 | 2103 |
| 2088 Expression* condition() const { return condition_; } | 2104 Expression* condition() const { return condition_; } |
| 2089 Expression* then_expression() const { return then_expression_; } | 2105 Expression* then_expression() const { return then_expression_; } |
| 2090 Expression* else_expression() const { return else_expression_; } | 2106 Expression* else_expression() const { return else_expression_; } |
| 2091 | 2107 |
| 2092 BailoutId ThenId() const { return then_id_; } | 2108 BailoutId ThenId() const { return then_id_; } |
| 2093 BailoutId ElseId() const { return else_id_; } | 2109 BailoutId ElseId() const { return else_id_; } |
| 2094 | 2110 |
| 2095 protected: | 2111 protected: |
| 2096 Conditional(Isolate* isolate, | 2112 Conditional(Zone* zone, |
| 2097 Expression* condition, | 2113 Expression* condition, |
| 2098 Expression* then_expression, | 2114 Expression* then_expression, |
| 2099 Expression* else_expression, | 2115 Expression* else_expression, |
| 2100 int position) | 2116 int position) |
| 2101 : Expression(isolate, position), | 2117 : Expression(zone, position), |
| 2102 condition_(condition), | 2118 condition_(condition), |
| 2103 then_expression_(then_expression), | 2119 then_expression_(then_expression), |
| 2104 else_expression_(else_expression), | 2120 else_expression_(else_expression), |
| 2105 then_id_(GetNextId(isolate)), | 2121 then_id_(GetNextId(zone)), |
| 2106 else_id_(GetNextId(isolate)) { } | 2122 else_id_(GetNextId(zone)) { } |
| 2107 | 2123 |
| 2108 private: | 2124 private: |
| 2109 Expression* condition_; | 2125 Expression* condition_; |
| 2110 Expression* then_expression_; | 2126 Expression* then_expression_; |
| 2111 Expression* else_expression_; | 2127 Expression* else_expression_; |
| 2112 const BailoutId then_id_; | 2128 const BailoutId then_id_; |
| 2113 const BailoutId else_id_; | 2129 const BailoutId else_id_; |
| 2114 }; | 2130 }; |
| 2115 | 2131 |
| 2116 | 2132 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2146 return &receiver_types_; | 2162 return &receiver_types_; |
| 2147 } | 2163 } |
| 2148 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { | 2164 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { |
| 2149 return store_mode_; | 2165 return store_mode_; |
| 2150 } | 2166 } |
| 2151 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } | 2167 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } |
| 2152 void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; } | 2168 void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; } |
| 2153 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } | 2169 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } |
| 2154 | 2170 |
| 2155 protected: | 2171 protected: |
| 2156 Assignment(Isolate* isolate, | 2172 Assignment(Zone* zone, |
| 2157 Token::Value op, | 2173 Token::Value op, |
| 2158 Expression* target, | 2174 Expression* target, |
| 2159 Expression* value, | 2175 Expression* value, |
| 2160 int pos); | 2176 int pos); |
| 2161 | 2177 |
| 2162 template<class Visitor> | 2178 template<class Visitor> |
| 2163 void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) { | 2179 void Init(Zone* zone, AstNodeFactory<Visitor>* factory) { |
| 2164 ASSERT(Token::IsAssignmentOp(op_)); | 2180 ASSERT(Token::IsAssignmentOp(op_)); |
| 2165 if (is_compound()) { | 2181 if (is_compound()) { |
| 2166 binary_operation_ = factory->NewBinaryOperation( | 2182 binary_operation_ = factory->NewBinaryOperation( |
| 2167 binary_op(), target_, value_, position() + 1); | 2183 binary_op(), target_, value_, position() + 1); |
| 2168 } | 2184 } |
| 2169 } | 2185 } |
| 2170 | 2186 |
| 2171 private: | 2187 private: |
| 2172 Token::Value op_; | 2188 Token::Value op_; |
| 2173 Expression* target_; | 2189 Expression* target_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2204 int index() const { | 2220 int index() const { |
| 2205 ASSERT(yield_kind() == DELEGATING); | 2221 ASSERT(yield_kind() == DELEGATING); |
| 2206 return index_; | 2222 return index_; |
| 2207 } | 2223 } |
| 2208 void set_index(int index) { | 2224 void set_index(int index) { |
| 2209 ASSERT(yield_kind() == DELEGATING); | 2225 ASSERT(yield_kind() == DELEGATING); |
| 2210 index_ = index; | 2226 index_ = index; |
| 2211 } | 2227 } |
| 2212 | 2228 |
| 2213 protected: | 2229 protected: |
| 2214 Yield(Isolate* isolate, | 2230 Yield(Zone* zone, |
| 2215 Expression* generator_object, | 2231 Expression* generator_object, |
| 2216 Expression* expression, | 2232 Expression* expression, |
| 2217 Kind yield_kind, | 2233 Kind yield_kind, |
| 2218 int pos) | 2234 int pos) |
| 2219 : Expression(isolate, pos), | 2235 : Expression(zone, pos), |
| 2220 generator_object_(generator_object), | 2236 generator_object_(generator_object), |
| 2221 expression_(expression), | 2237 expression_(expression), |
| 2222 yield_kind_(yield_kind), | 2238 yield_kind_(yield_kind), |
| 2223 index_(-1) { } | 2239 index_(-1) { } |
| 2224 | 2240 |
| 2225 private: | 2241 private: |
| 2226 Expression* generator_object_; | 2242 Expression* generator_object_; |
| 2227 Expression* expression_; | 2243 Expression* expression_; |
| 2228 Kind yield_kind_; | 2244 Kind yield_kind_; |
| 2229 int index_; | 2245 int index_; |
| 2230 }; | 2246 }; |
| 2231 | 2247 |
| 2232 | 2248 |
| 2233 class Throw V8_FINAL : public Expression { | 2249 class Throw V8_FINAL : public Expression { |
| 2234 public: | 2250 public: |
| 2235 DECLARE_NODE_TYPE(Throw) | 2251 DECLARE_NODE_TYPE(Throw) |
| 2236 | 2252 |
| 2237 Expression* exception() const { return exception_; } | 2253 Expression* exception() const { return exception_; } |
| 2238 | 2254 |
| 2239 protected: | 2255 protected: |
| 2240 Throw(Isolate* isolate, Expression* exception, int pos) | 2256 Throw(Zone* zone, Expression* exception, int pos) |
| 2241 : Expression(isolate, pos), exception_(exception) {} | 2257 : Expression(zone, pos), exception_(exception) {} |
| 2242 | 2258 |
| 2243 private: | 2259 private: |
| 2244 Expression* exception_; | 2260 Expression* exception_; |
| 2245 }; | 2261 }; |
| 2246 | 2262 |
| 2247 | 2263 |
| 2248 class FunctionLiteral V8_FINAL : public Expression { | 2264 class FunctionLiteral V8_FINAL : public Expression { |
| 2249 public: | 2265 public: |
| 2250 enum FunctionType { | 2266 enum FunctionType { |
| 2251 ANONYMOUS_EXPRESSION, | 2267 ANONYMOUS_EXPRESSION, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2342 ast_properties_ = *ast_properties; | 2358 ast_properties_ = *ast_properties; |
| 2343 } | 2359 } |
| 2344 | 2360 |
| 2345 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } | 2361 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } |
| 2346 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } | 2362 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } |
| 2347 void set_dont_optimize_reason(BailoutReason reason) { | 2363 void set_dont_optimize_reason(BailoutReason reason) { |
| 2348 dont_optimize_reason_ = reason; | 2364 dont_optimize_reason_ = reason; |
| 2349 } | 2365 } |
| 2350 | 2366 |
| 2351 protected: | 2367 protected: |
| 2352 FunctionLiteral(Isolate* isolate, | 2368 FunctionLiteral(Zone* zone, |
| 2353 Handle<String> name, | 2369 Handle<String> name, |
| 2354 Scope* scope, | 2370 Scope* scope, |
| 2355 ZoneList<Statement*>* body, | 2371 ZoneList<Statement*>* body, |
| 2356 int materialized_literal_count, | 2372 int materialized_literal_count, |
| 2357 int expected_property_count, | 2373 int expected_property_count, |
| 2358 int handler_count, | 2374 int handler_count, |
| 2359 int parameter_count, | 2375 int parameter_count, |
| 2360 FunctionType function_type, | 2376 FunctionType function_type, |
| 2361 ParameterFlag has_duplicate_parameters, | 2377 ParameterFlag has_duplicate_parameters, |
| 2362 IsFunctionFlag is_function, | 2378 IsFunctionFlag is_function, |
| 2363 IsParenthesizedFlag is_parenthesized, | 2379 IsParenthesizedFlag is_parenthesized, |
| 2364 IsGeneratorFlag is_generator, | 2380 IsGeneratorFlag is_generator, |
| 2365 int position) | 2381 int position) |
| 2366 : Expression(isolate, position), | 2382 : Expression(zone, position), |
| 2367 name_(name), | 2383 name_(name), |
| 2368 scope_(scope), | 2384 scope_(scope), |
| 2369 body_(body), | 2385 body_(body), |
| 2370 inferred_name_(isolate->factory()->empty_string()), | 2386 inferred_name_(zone->isolate()->factory()->empty_string()), |
| 2371 dont_optimize_reason_(kNoReason), | 2387 dont_optimize_reason_(kNoReason), |
| 2372 materialized_literal_count_(materialized_literal_count), | 2388 materialized_literal_count_(materialized_literal_count), |
| 2373 expected_property_count_(expected_property_count), | 2389 expected_property_count_(expected_property_count), |
| 2374 handler_count_(handler_count), | 2390 handler_count_(handler_count), |
| 2375 parameter_count_(parameter_count), | 2391 parameter_count_(parameter_count), |
| 2376 function_token_position_(RelocInfo::kNoPosition) { | 2392 function_token_position_(RelocInfo::kNoPosition) { |
| 2377 bitfield_ = | 2393 bitfield_ = |
| 2378 IsExpression::encode(function_type != DECLARATION) | | 2394 IsExpression::encode(function_type != DECLARATION) | |
| 2379 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) | | 2395 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) | |
| 2380 Pretenure::encode(false) | | 2396 Pretenure::encode(false) | |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2412 | 2428 |
| 2413 class NativeFunctionLiteral V8_FINAL : public Expression { | 2429 class NativeFunctionLiteral V8_FINAL : public Expression { |
| 2414 public: | 2430 public: |
| 2415 DECLARE_NODE_TYPE(NativeFunctionLiteral) | 2431 DECLARE_NODE_TYPE(NativeFunctionLiteral) |
| 2416 | 2432 |
| 2417 Handle<String> name() const { return name_; } | 2433 Handle<String> name() const { return name_; } |
| 2418 v8::Extension* extension() const { return extension_; } | 2434 v8::Extension* extension() const { return extension_; } |
| 2419 | 2435 |
| 2420 protected: | 2436 protected: |
| 2421 NativeFunctionLiteral( | 2437 NativeFunctionLiteral( |
| 2422 Isolate* isolate, Handle<String> name, v8::Extension* extension, int pos) | 2438 Zone* zone, Handle<String> name, v8::Extension* extension, int pos) |
| 2423 : Expression(isolate, pos), name_(name), extension_(extension) {} | 2439 : Expression(zone, pos), name_(name), extension_(extension) {} |
| 2424 | 2440 |
| 2425 private: | 2441 private: |
| 2426 Handle<String> name_; | 2442 Handle<String> name_; |
| 2427 v8::Extension* extension_; | 2443 v8::Extension* extension_; |
| 2428 }; | 2444 }; |
| 2429 | 2445 |
| 2430 | 2446 |
| 2431 class ThisFunction V8_FINAL : public Expression { | 2447 class ThisFunction V8_FINAL : public Expression { |
| 2432 public: | 2448 public: |
| 2433 DECLARE_NODE_TYPE(ThisFunction) | 2449 DECLARE_NODE_TYPE(ThisFunction) |
| 2434 | 2450 |
| 2435 protected: | 2451 protected: |
| 2436 explicit ThisFunction(Isolate* isolate, int pos): Expression(isolate, pos) {} | 2452 explicit ThisFunction(Zone* zone, int pos): Expression(zone, pos) {} |
| 2437 }; | 2453 }; |
| 2438 | 2454 |
| 2439 #undef DECLARE_NODE_TYPE | 2455 #undef DECLARE_NODE_TYPE |
| 2440 | 2456 |
| 2441 | 2457 |
| 2442 // ---------------------------------------------------------------------------- | 2458 // ---------------------------------------------------------------------------- |
| 2443 // Regular expressions | 2459 // Regular expressions |
| 2444 | 2460 |
| 2445 | 2461 |
| 2446 class RegExpVisitor BASE_EMBEDDED { | 2462 class RegExpVisitor BASE_EMBEDDED { |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2793 static RegExpEmpty* GetInstance() { | 2809 static RegExpEmpty* GetInstance() { |
| 2794 static RegExpEmpty* instance = ::new RegExpEmpty(); | 2810 static RegExpEmpty* instance = ::new RegExpEmpty(); |
| 2795 return instance; | 2811 return instance; |
| 2796 } | 2812 } |
| 2797 }; | 2813 }; |
| 2798 | 2814 |
| 2799 | 2815 |
| 2800 // ---------------------------------------------------------------------------- | 2816 // ---------------------------------------------------------------------------- |
| 2801 // Out-of-line inline constructors (to side-step cyclic dependencies). | 2817 // Out-of-line inline constructors (to side-step cyclic dependencies). |
| 2802 | 2818 |
| 2803 inline ModuleVariable::ModuleVariable(VariableProxy* proxy, int pos) | 2819 inline ModuleVariable::ModuleVariable(Zone* zone, VariableProxy* proxy, int pos) |
| 2804 : Module(proxy->interface(), pos), | 2820 : Module(zone, proxy->interface(), pos), |
| 2805 proxy_(proxy) { | 2821 proxy_(proxy) { |
| 2806 } | 2822 } |
| 2807 | 2823 |
| 2808 | 2824 |
| 2809 // ---------------------------------------------------------------------------- | 2825 // ---------------------------------------------------------------------------- |
| 2810 // Basic visitor | 2826 // Basic visitor |
| 2811 // - leaf node visitors are abstract. | 2827 // - leaf node visitors are abstract. |
| 2812 | 2828 |
| 2813 class AstVisitor BASE_EMBEDDED { | 2829 class AstVisitor BASE_EMBEDDED { |
| 2814 public: | 2830 public: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2826 // Individual AST nodes. | 2842 // Individual AST nodes. |
| 2827 #define DEF_VISIT(type) \ | 2843 #define DEF_VISIT(type) \ |
| 2828 virtual void Visit##type(type* node) = 0; | 2844 virtual void Visit##type(type* node) = 0; |
| 2829 AST_NODE_LIST(DEF_VISIT) | 2845 AST_NODE_LIST(DEF_VISIT) |
| 2830 #undef DEF_VISIT | 2846 #undef DEF_VISIT |
| 2831 }; | 2847 }; |
| 2832 | 2848 |
| 2833 | 2849 |
| 2834 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ | 2850 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ |
| 2835 public: \ | 2851 public: \ |
| 2836 virtual void Visit(AstNode* node) V8_FINAL V8_OVERRIDE { \ | 2852 virtual void Visit(AstNode* node) V8_FINAL V8_OVERRIDE { \ |
| 2837 if (!CheckStackOverflow()) node->Accept(this); \ | 2853 if (!CheckStackOverflow()) node->Accept(this); \ |
| 2838 } \ | 2854 } \ |
| 2839 \ | 2855 \ |
| 2840 void SetStackOverflow() { stack_overflow_ = true; } \ | 2856 void SetStackOverflow() { stack_overflow_ = true; } \ |
| 2841 void ClearStackOverflow() { stack_overflow_ = false; } \ | 2857 void ClearStackOverflow() { stack_overflow_ = false; } \ |
| 2842 bool HasStackOverflow() const { return stack_overflow_; } \ | 2858 bool HasStackOverflow() const { return stack_overflow_; } \ |
| 2843 \ | 2859 \ |
| 2844 bool CheckStackOverflow() { \ | 2860 bool CheckStackOverflow() { \ |
| 2845 if (stack_overflow_) return true; \ | 2861 if (stack_overflow_) return true; \ |
| 2846 StackLimitCheck check(isolate_); \ | 2862 StackLimitCheck check(zone_->isolate()); \ |
| 2847 if (!check.HasOverflowed()) return false; \ | 2863 if (!check.HasOverflowed()) return false; \ |
| 2848 return (stack_overflow_ = true); \ | 2864 return (stack_overflow_ = true); \ |
| 2849 } \ | 2865 } \ |
| 2850 \ | 2866 \ |
| 2851 private: \ | 2867 private: \ |
| 2852 void InitializeAstVisitor(Isolate* isolate) { \ | 2868 void InitializeAstVisitor(Zone* zone) { \ |
| 2853 isolate_ = isolate; \ | 2869 zone_ = zone; \ |
| 2854 stack_overflow_ = false; \ | 2870 stack_overflow_ = false; \ |
| 2855 } \ | 2871 } \ |
| 2856 Isolate* isolate() { return isolate_; } \ | 2872 Zone* zone() { return zone_; } \ |
| 2873 Isolate* isolate() { return zone_->isolate(); } \ |
| 2857 \ | 2874 \ |
| 2858 Isolate* isolate_; \ | 2875 Zone* zone_; \ |
| 2859 bool stack_overflow_ | 2876 bool stack_overflow_ |
| 2860 | 2877 |
| 2861 | 2878 |
| 2862 // ---------------------------------------------------------------------------- | 2879 // ---------------------------------------------------------------------------- |
| 2863 // Construction time visitor. | 2880 // Construction time visitor. |
| 2864 | 2881 |
| 2865 class AstConstructionVisitor BASE_EMBEDDED { | 2882 class AstConstructionVisitor BASE_EMBEDDED { |
| 2866 public: | 2883 public: |
| 2867 AstConstructionVisitor() : dont_optimize_reason_(kNoReason) { } | 2884 AstConstructionVisitor() : dont_optimize_reason_(kNoReason) { } |
| 2868 | 2885 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2899 }; | 2916 }; |
| 2900 | 2917 |
| 2901 | 2918 |
| 2902 | 2919 |
| 2903 // ---------------------------------------------------------------------------- | 2920 // ---------------------------------------------------------------------------- |
| 2904 // AstNode factory | 2921 // AstNode factory |
| 2905 | 2922 |
| 2906 template<class Visitor> | 2923 template<class Visitor> |
| 2907 class AstNodeFactory V8_FINAL BASE_EMBEDDED { | 2924 class AstNodeFactory V8_FINAL BASE_EMBEDDED { |
| 2908 public: | 2925 public: |
| 2909 AstNodeFactory(Isolate* isolate, Zone* zone) | 2926 explicit AstNodeFactory(Zone* zone) : zone_(zone) { } |
| 2910 : isolate_(isolate), | |
| 2911 zone_(zone) { } | |
| 2912 | 2927 |
| 2913 Visitor* visitor() { return &visitor_; } | 2928 Visitor* visitor() { return &visitor_; } |
| 2914 | 2929 |
| 2915 #define VISIT_AND_RETURN(NodeType, node) \ | 2930 #define VISIT_AND_RETURN(NodeType, node) \ |
| 2916 visitor_.Visit##NodeType((node)); \ | 2931 visitor_.Visit##NodeType((node)); \ |
| 2917 return node; | 2932 return node; |
| 2918 | 2933 |
| 2919 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, | 2934 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, |
| 2920 VariableMode mode, | 2935 VariableMode mode, |
| 2921 Scope* scope, | 2936 Scope* scope, |
| 2922 int pos) { | 2937 int pos) { |
| 2923 VariableDeclaration* decl = | 2938 VariableDeclaration* decl = |
| 2924 new(zone_) VariableDeclaration(proxy, mode, scope, pos); | 2939 new(zone_) VariableDeclaration(zone_, proxy, mode, scope, pos); |
| 2925 VISIT_AND_RETURN(VariableDeclaration, decl) | 2940 VISIT_AND_RETURN(VariableDeclaration, decl) |
| 2926 } | 2941 } |
| 2927 | 2942 |
| 2928 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy, | 2943 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy, |
| 2929 VariableMode mode, | 2944 VariableMode mode, |
| 2930 FunctionLiteral* fun, | 2945 FunctionLiteral* fun, |
| 2931 Scope* scope, | 2946 Scope* scope, |
| 2932 int pos) { | 2947 int pos) { |
| 2933 FunctionDeclaration* decl = | 2948 FunctionDeclaration* decl = |
| 2934 new(zone_) FunctionDeclaration(proxy, mode, fun, scope, pos); | 2949 new(zone_) FunctionDeclaration(zone_, proxy, mode, fun, scope, pos); |
| 2935 VISIT_AND_RETURN(FunctionDeclaration, decl) | 2950 VISIT_AND_RETURN(FunctionDeclaration, decl) |
| 2936 } | 2951 } |
| 2937 | 2952 |
| 2938 ModuleDeclaration* NewModuleDeclaration(VariableProxy* proxy, | 2953 ModuleDeclaration* NewModuleDeclaration(VariableProxy* proxy, |
| 2939 Module* module, | 2954 Module* module, |
| 2940 Scope* scope, | 2955 Scope* scope, |
| 2941 int pos) { | 2956 int pos) { |
| 2942 ModuleDeclaration* decl = | 2957 ModuleDeclaration* decl = |
| 2943 new(zone_) ModuleDeclaration(proxy, module, scope, pos); | 2958 new(zone_) ModuleDeclaration(zone_, proxy, module, scope, pos); |
| 2944 VISIT_AND_RETURN(ModuleDeclaration, decl) | 2959 VISIT_AND_RETURN(ModuleDeclaration, decl) |
| 2945 } | 2960 } |
| 2946 | 2961 |
| 2947 ImportDeclaration* NewImportDeclaration(VariableProxy* proxy, | 2962 ImportDeclaration* NewImportDeclaration(VariableProxy* proxy, |
| 2948 Module* module, | 2963 Module* module, |
| 2949 Scope* scope, | 2964 Scope* scope, |
| 2950 int pos) { | 2965 int pos) { |
| 2951 ImportDeclaration* decl = | 2966 ImportDeclaration* decl = |
| 2952 new(zone_) ImportDeclaration(proxy, module, scope, pos); | 2967 new(zone_) ImportDeclaration(zone_, proxy, module, scope, pos); |
| 2953 VISIT_AND_RETURN(ImportDeclaration, decl) | 2968 VISIT_AND_RETURN(ImportDeclaration, decl) |
| 2954 } | 2969 } |
| 2955 | 2970 |
| 2956 ExportDeclaration* NewExportDeclaration(VariableProxy* proxy, | 2971 ExportDeclaration* NewExportDeclaration(VariableProxy* proxy, |
| 2957 Scope* scope, | 2972 Scope* scope, |
| 2958 int pos) { | 2973 int pos) { |
| 2959 ExportDeclaration* decl = | 2974 ExportDeclaration* decl = |
| 2960 new(zone_) ExportDeclaration(proxy, scope, pos); | 2975 new(zone_) ExportDeclaration(zone_, proxy, scope, pos); |
| 2961 VISIT_AND_RETURN(ExportDeclaration, decl) | 2976 VISIT_AND_RETURN(ExportDeclaration, decl) |
| 2962 } | 2977 } |
| 2963 | 2978 |
| 2964 ModuleLiteral* NewModuleLiteral(Block* body, Interface* interface, int pos) { | 2979 ModuleLiteral* NewModuleLiteral(Block* body, Interface* interface, int pos) { |
| 2965 ModuleLiteral* module = new(zone_) ModuleLiteral(body, interface, pos); | 2980 ModuleLiteral* module = |
| 2981 new(zone_) ModuleLiteral(zone_, body, interface, pos); |
| 2966 VISIT_AND_RETURN(ModuleLiteral, module) | 2982 VISIT_AND_RETURN(ModuleLiteral, module) |
| 2967 } | 2983 } |
| 2968 | 2984 |
| 2969 ModuleVariable* NewModuleVariable(VariableProxy* proxy, int pos) { | 2985 ModuleVariable* NewModuleVariable(VariableProxy* proxy, int pos) { |
| 2970 ModuleVariable* module = new(zone_) ModuleVariable(proxy, pos); | 2986 ModuleVariable* module = new(zone_) ModuleVariable(zone_, proxy, pos); |
| 2971 VISIT_AND_RETURN(ModuleVariable, module) | 2987 VISIT_AND_RETURN(ModuleVariable, module) |
| 2972 } | 2988 } |
| 2973 | 2989 |
| 2974 ModulePath* NewModulePath(Module* origin, Handle<String> name, int pos) { | 2990 ModulePath* NewModulePath(Module* origin, Handle<String> name, int pos) { |
| 2975 ModulePath* module = new(zone_) ModulePath(origin, name, zone_, pos); | 2991 ModulePath* module = new(zone_) ModulePath(zone_, origin, name, pos); |
| 2976 VISIT_AND_RETURN(ModulePath, module) | 2992 VISIT_AND_RETURN(ModulePath, module) |
| 2977 } | 2993 } |
| 2978 | 2994 |
| 2979 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) { | 2995 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) { |
| 2980 ModuleUrl* module = new(zone_) ModuleUrl(url, zone_, pos); | 2996 ModuleUrl* module = new(zone_) ModuleUrl(zone_, url, pos); |
| 2981 VISIT_AND_RETURN(ModuleUrl, module) | 2997 VISIT_AND_RETURN(ModuleUrl, module) |
| 2982 } | 2998 } |
| 2983 | 2999 |
| 2984 Block* NewBlock(ZoneStringList* labels, | 3000 Block* NewBlock(ZoneStringList* labels, |
| 2985 int capacity, | 3001 int capacity, |
| 2986 bool is_initializer_block, | 3002 bool is_initializer_block, |
| 2987 int pos) { | 3003 int pos) { |
| 2988 Block* block = new(zone_) Block( | 3004 Block* block = new(zone_) Block( |
| 2989 isolate_, labels, capacity, is_initializer_block, pos, zone_); | 3005 zone_, labels, capacity, is_initializer_block, pos); |
| 2990 VISIT_AND_RETURN(Block, block) | 3006 VISIT_AND_RETURN(Block, block) |
| 2991 } | 3007 } |
| 2992 | 3008 |
| 2993 #define STATEMENT_WITH_LABELS(NodeType) \ | 3009 #define STATEMENT_WITH_LABELS(NodeType) \ |
| 2994 NodeType* New##NodeType(ZoneStringList* labels, int pos) { \ | 3010 NodeType* New##NodeType(ZoneStringList* labels, int pos) { \ |
| 2995 NodeType* stmt = new(zone_) NodeType(isolate_, labels, pos); \ | 3011 NodeType* stmt = new(zone_) NodeType(zone_, labels, pos); \ |
| 2996 VISIT_AND_RETURN(NodeType, stmt); \ | 3012 VISIT_AND_RETURN(NodeType, stmt); \ |
| 2997 } | 3013 } |
| 2998 STATEMENT_WITH_LABELS(DoWhileStatement) | 3014 STATEMENT_WITH_LABELS(DoWhileStatement) |
| 2999 STATEMENT_WITH_LABELS(WhileStatement) | 3015 STATEMENT_WITH_LABELS(WhileStatement) |
| 3000 STATEMENT_WITH_LABELS(ForStatement) | 3016 STATEMENT_WITH_LABELS(ForStatement) |
| 3001 STATEMENT_WITH_LABELS(SwitchStatement) | 3017 STATEMENT_WITH_LABELS(SwitchStatement) |
| 3002 #undef STATEMENT_WITH_LABELS | 3018 #undef STATEMENT_WITH_LABELS |
| 3003 | 3019 |
| 3004 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode, | 3020 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode, |
| 3005 ZoneStringList* labels, | 3021 ZoneStringList* labels, |
| 3006 int pos) { | 3022 int pos) { |
| 3007 switch (visit_mode) { | 3023 switch (visit_mode) { |
| 3008 case ForEachStatement::ENUMERATE: { | 3024 case ForEachStatement::ENUMERATE: { |
| 3009 ForInStatement* stmt = new(zone_) ForInStatement(isolate_, labels, pos); | 3025 ForInStatement* stmt = new(zone_) ForInStatement(zone_, labels, pos); |
| 3010 VISIT_AND_RETURN(ForInStatement, stmt); | 3026 VISIT_AND_RETURN(ForInStatement, stmt); |
| 3011 } | 3027 } |
| 3012 case ForEachStatement::ITERATE: { | 3028 case ForEachStatement::ITERATE: { |
| 3013 ForOfStatement* stmt = new(zone_) ForOfStatement(isolate_, labels, pos); | 3029 ForOfStatement* stmt = new(zone_) ForOfStatement(zone_, labels, pos); |
| 3014 VISIT_AND_RETURN(ForOfStatement, stmt); | 3030 VISIT_AND_RETURN(ForOfStatement, stmt); |
| 3015 } | 3031 } |
| 3016 } | 3032 } |
| 3017 UNREACHABLE(); | 3033 UNREACHABLE(); |
| 3018 return NULL; | 3034 return NULL; |
| 3019 } | 3035 } |
| 3020 | 3036 |
| 3021 ModuleStatement* NewModuleStatement( | 3037 ModuleStatement* NewModuleStatement( |
| 3022 VariableProxy* proxy, Block* body, int pos) { | 3038 VariableProxy* proxy, Block* body, int pos) { |
| 3023 ModuleStatement* stmt = new(zone_) ModuleStatement(proxy, body, pos); | 3039 ModuleStatement* stmt = new(zone_) ModuleStatement(zone_, proxy, body, pos); |
| 3024 VISIT_AND_RETURN(ModuleStatement, stmt) | 3040 VISIT_AND_RETURN(ModuleStatement, stmt) |
| 3025 } | 3041 } |
| 3026 | 3042 |
| 3027 ExpressionStatement* NewExpressionStatement(Expression* expression, int pos) { | 3043 ExpressionStatement* NewExpressionStatement(Expression* expression, int pos) { |
| 3028 ExpressionStatement* stmt = new(zone_) ExpressionStatement(expression, pos); | 3044 ExpressionStatement* stmt = |
| 3045 new(zone_) ExpressionStatement(zone_, expression, pos); |
| 3029 VISIT_AND_RETURN(ExpressionStatement, stmt) | 3046 VISIT_AND_RETURN(ExpressionStatement, stmt) |
| 3030 } | 3047 } |
| 3031 | 3048 |
| 3032 ContinueStatement* NewContinueStatement(IterationStatement* target, int pos) { | 3049 ContinueStatement* NewContinueStatement(IterationStatement* target, int pos) { |
| 3033 ContinueStatement* stmt = new(zone_) ContinueStatement(target, pos); | 3050 ContinueStatement* stmt = new(zone_) ContinueStatement(zone_, target, pos); |
| 3034 VISIT_AND_RETURN(ContinueStatement, stmt) | 3051 VISIT_AND_RETURN(ContinueStatement, stmt) |
| 3035 } | 3052 } |
| 3036 | 3053 |
| 3037 BreakStatement* NewBreakStatement(BreakableStatement* target, int pos) { | 3054 BreakStatement* NewBreakStatement(BreakableStatement* target, int pos) { |
| 3038 BreakStatement* stmt = new(zone_) BreakStatement(target, pos); | 3055 BreakStatement* stmt = new(zone_) BreakStatement(zone_, target, pos); |
| 3039 VISIT_AND_RETURN(BreakStatement, stmt) | 3056 VISIT_AND_RETURN(BreakStatement, stmt) |
| 3040 } | 3057 } |
| 3041 | 3058 |
| 3042 ReturnStatement* NewReturnStatement(Expression* expression, int pos) { | 3059 ReturnStatement* NewReturnStatement(Expression* expression, int pos) { |
| 3043 ReturnStatement* stmt = new(zone_) ReturnStatement(expression, pos); | 3060 ReturnStatement* stmt = new(zone_) ReturnStatement(zone_, expression, pos); |
| 3044 VISIT_AND_RETURN(ReturnStatement, stmt) | 3061 VISIT_AND_RETURN(ReturnStatement, stmt) |
| 3045 } | 3062 } |
| 3046 | 3063 |
| 3047 WithStatement* NewWithStatement(Scope* scope, | 3064 WithStatement* NewWithStatement(Scope* scope, |
| 3048 Expression* expression, | 3065 Expression* expression, |
| 3049 Statement* statement, | 3066 Statement* statement, |
| 3050 int pos) { | 3067 int pos) { |
| 3051 WithStatement* stmt = new(zone_) WithStatement( | 3068 WithStatement* stmt = new(zone_) WithStatement( |
| 3052 scope, expression, statement, pos); | 3069 zone_, scope, expression, statement, pos); |
| 3053 VISIT_AND_RETURN(WithStatement, stmt) | 3070 VISIT_AND_RETURN(WithStatement, stmt) |
| 3054 } | 3071 } |
| 3055 | 3072 |
| 3056 IfStatement* NewIfStatement(Expression* condition, | 3073 IfStatement* NewIfStatement(Expression* condition, |
| 3057 Statement* then_statement, | 3074 Statement* then_statement, |
| 3058 Statement* else_statement, | 3075 Statement* else_statement, |
| 3059 int pos) { | 3076 int pos) { |
| 3060 IfStatement* stmt = new(zone_) IfStatement( | 3077 IfStatement* stmt = new(zone_) IfStatement( |
| 3061 isolate_, condition, then_statement, else_statement, pos); | 3078 zone_, condition, then_statement, else_statement, pos); |
| 3062 VISIT_AND_RETURN(IfStatement, stmt) | 3079 VISIT_AND_RETURN(IfStatement, stmt) |
| 3063 } | 3080 } |
| 3064 | 3081 |
| 3065 TryCatchStatement* NewTryCatchStatement(int index, | 3082 TryCatchStatement* NewTryCatchStatement(int index, |
| 3066 Block* try_block, | 3083 Block* try_block, |
| 3067 Scope* scope, | 3084 Scope* scope, |
| 3068 Variable* variable, | 3085 Variable* variable, |
| 3069 Block* catch_block, | 3086 Block* catch_block, |
| 3070 int pos) { | 3087 int pos) { |
| 3071 TryCatchStatement* stmt = new(zone_) TryCatchStatement( | 3088 TryCatchStatement* stmt = new(zone_) TryCatchStatement( |
| 3072 index, try_block, scope, variable, catch_block, pos); | 3089 zone_, index, try_block, scope, variable, catch_block, pos); |
| 3073 VISIT_AND_RETURN(TryCatchStatement, stmt) | 3090 VISIT_AND_RETURN(TryCatchStatement, stmt) |
| 3074 } | 3091 } |
| 3075 | 3092 |
| 3076 TryFinallyStatement* NewTryFinallyStatement(int index, | 3093 TryFinallyStatement* NewTryFinallyStatement(int index, |
| 3077 Block* try_block, | 3094 Block* try_block, |
| 3078 Block* finally_block, | 3095 Block* finally_block, |
| 3079 int pos) { | 3096 int pos) { |
| 3080 TryFinallyStatement* stmt = | 3097 TryFinallyStatement* stmt = new(zone_) TryFinallyStatement( |
| 3081 new(zone_) TryFinallyStatement(index, try_block, finally_block, pos); | 3098 zone_, index, try_block, finally_block, pos); |
| 3082 VISIT_AND_RETURN(TryFinallyStatement, stmt) | 3099 VISIT_AND_RETURN(TryFinallyStatement, stmt) |
| 3083 } | 3100 } |
| 3084 | 3101 |
| 3085 DebuggerStatement* NewDebuggerStatement(int pos) { | 3102 DebuggerStatement* NewDebuggerStatement(int pos) { |
| 3086 DebuggerStatement* stmt = new(zone_) DebuggerStatement(pos); | 3103 DebuggerStatement* stmt = new(zone_) DebuggerStatement(zone_, pos); |
| 3087 VISIT_AND_RETURN(DebuggerStatement, stmt) | 3104 VISIT_AND_RETURN(DebuggerStatement, stmt) |
| 3088 } | 3105 } |
| 3089 | 3106 |
| 3090 EmptyStatement* NewEmptyStatement(int pos) { | 3107 EmptyStatement* NewEmptyStatement(int pos) { |
| 3091 return new(zone_) EmptyStatement(pos); | 3108 return new(zone_) EmptyStatement(zone_, pos); |
| 3092 } | 3109 } |
| 3093 | 3110 |
| 3094 CaseClause* NewCaseClause( | 3111 CaseClause* NewCaseClause( |
| 3095 Expression* label, ZoneList<Statement*>* statements, int pos) { | 3112 Expression* label, ZoneList<Statement*>* statements, int pos) { |
| 3096 CaseClause* clause = | 3113 CaseClause* clause = |
| 3097 new(zone_) CaseClause(isolate_, label, statements, pos); | 3114 new(zone_) CaseClause(zone_, label, statements, pos); |
| 3098 VISIT_AND_RETURN(CaseClause, clause) | 3115 VISIT_AND_RETURN(CaseClause, clause) |
| 3099 } | 3116 } |
| 3100 | 3117 |
| 3101 Literal* NewLiteral(Handle<Object> handle, int pos) { | 3118 Literal* NewLiteral(Handle<Object> handle, int pos) { |
| 3102 Literal* lit = new(zone_) Literal(isolate_, handle, pos); | 3119 Literal* lit = new(zone_) Literal(zone_, handle, pos); |
| 3103 VISIT_AND_RETURN(Literal, lit) | 3120 VISIT_AND_RETURN(Literal, lit) |
| 3104 } | 3121 } |
| 3105 | 3122 |
| 3106 Literal* NewNumberLiteral(double number, int pos) { | 3123 Literal* NewNumberLiteral(double number, int pos) { |
| 3107 return NewLiteral(isolate_->factory()->NewNumber(number, TENURED), pos); | 3124 return NewLiteral( |
| 3125 zone_->isolate()->factory()->NewNumber(number, TENURED), pos); |
| 3108 } | 3126 } |
| 3109 | 3127 |
| 3110 ObjectLiteral* NewObjectLiteral( | 3128 ObjectLiteral* NewObjectLiteral( |
| 3111 ZoneList<ObjectLiteral::Property*>* properties, | 3129 ZoneList<ObjectLiteral::Property*>* properties, |
| 3112 int literal_index, | 3130 int literal_index, |
| 3113 int boilerplate_properties, | 3131 int boilerplate_properties, |
| 3114 bool has_function, | 3132 bool has_function, |
| 3115 int pos) { | 3133 int pos) { |
| 3116 ObjectLiteral* lit = new(zone_) ObjectLiteral( | 3134 ObjectLiteral* lit = new(zone_) ObjectLiteral( |
| 3117 isolate_, properties, literal_index, boilerplate_properties, | 3135 zone_, properties, literal_index, boilerplate_properties, |
| 3118 has_function, pos); | 3136 has_function, pos); |
| 3119 VISIT_AND_RETURN(ObjectLiteral, lit) | 3137 VISIT_AND_RETURN(ObjectLiteral, lit) |
| 3120 } | 3138 } |
| 3121 | 3139 |
| 3140 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key, |
| 3141 Expression* value) { |
| 3142 return new(zone_) ObjectLiteral::Property(zone_, key, value); |
| 3143 } |
| 3144 |
| 3122 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, | 3145 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, |
| 3123 FunctionLiteral* value, | 3146 FunctionLiteral* value, |
| 3124 int pos) { | 3147 int pos) { |
| 3125 ObjectLiteral::Property* prop = | 3148 ObjectLiteral::Property* prop = |
| 3126 new(zone_) ObjectLiteral::Property(is_getter, value); | 3149 new(zone_) ObjectLiteral::Property(zone_, is_getter, value); |
| 3127 prop->set_key(NewLiteral(value->name(), pos)); | 3150 prop->set_key(NewLiteral(value->name(), pos)); |
| 3128 return prop; // Not an AST node, will not be visited. | 3151 return prop; // Not an AST node, will not be visited. |
| 3129 } | 3152 } |
| 3130 | 3153 |
| 3131 RegExpLiteral* NewRegExpLiteral(Handle<String> pattern, | 3154 RegExpLiteral* NewRegExpLiteral(Handle<String> pattern, |
| 3132 Handle<String> flags, | 3155 Handle<String> flags, |
| 3133 int literal_index, | 3156 int literal_index, |
| 3134 int pos) { | 3157 int pos) { |
| 3135 RegExpLiteral* lit = | 3158 RegExpLiteral* lit = |
| 3136 new(zone_) RegExpLiteral(isolate_, pattern, flags, literal_index, pos); | 3159 new(zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos); |
| 3137 VISIT_AND_RETURN(RegExpLiteral, lit); | 3160 VISIT_AND_RETURN(RegExpLiteral, lit); |
| 3138 } | 3161 } |
| 3139 | 3162 |
| 3140 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, | 3163 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, |
| 3141 int literal_index, | 3164 int literal_index, |
| 3142 int pos) { | 3165 int pos) { |
| 3143 ArrayLiteral* lit = new(zone_) ArrayLiteral( | 3166 ArrayLiteral* lit = new(zone_) ArrayLiteral( |
| 3144 isolate_, values, literal_index, pos); | 3167 zone_, values, literal_index, pos); |
| 3145 VISIT_AND_RETURN(ArrayLiteral, lit) | 3168 VISIT_AND_RETURN(ArrayLiteral, lit) |
| 3146 } | 3169 } |
| 3147 | 3170 |
| 3148 VariableProxy* NewVariableProxy(Variable* var, | 3171 VariableProxy* NewVariableProxy(Variable* var, |
| 3149 int pos = RelocInfo::kNoPosition) { | 3172 int pos = RelocInfo::kNoPosition) { |
| 3150 VariableProxy* proxy = new(zone_) VariableProxy(isolate_, var, pos); | 3173 VariableProxy* proxy = new(zone_) VariableProxy(zone_, var, pos); |
| 3151 VISIT_AND_RETURN(VariableProxy, proxy) | 3174 VISIT_AND_RETURN(VariableProxy, proxy) |
| 3152 } | 3175 } |
| 3153 | 3176 |
| 3154 VariableProxy* NewVariableProxy(Handle<String> name, | 3177 VariableProxy* NewVariableProxy(Handle<String> name, |
| 3155 bool is_this, | 3178 bool is_this, |
| 3156 Interface* interface = Interface::NewValue(), | 3179 Interface* interface = Interface::NewValue(), |
| 3157 int position = RelocInfo::kNoPosition) { | 3180 int position = RelocInfo::kNoPosition) { |
| 3158 VariableProxy* proxy = | 3181 VariableProxy* proxy = |
| 3159 new(zone_) VariableProxy(isolate_, name, is_this, interface, position); | 3182 new(zone_) VariableProxy(zone_, name, is_this, interface, position); |
| 3160 VISIT_AND_RETURN(VariableProxy, proxy) | 3183 VISIT_AND_RETURN(VariableProxy, proxy) |
| 3161 } | 3184 } |
| 3162 | 3185 |
| 3163 Property* NewProperty(Expression* obj, Expression* key, int pos) { | 3186 Property* NewProperty(Expression* obj, Expression* key, int pos) { |
| 3164 Property* prop = new(zone_) Property(isolate_, obj, key, pos); | 3187 Property* prop = new(zone_) Property(zone_, obj, key, pos); |
| 3165 VISIT_AND_RETURN(Property, prop) | 3188 VISIT_AND_RETURN(Property, prop) |
| 3166 } | 3189 } |
| 3167 | 3190 |
| 3168 Call* NewCall(Expression* expression, | 3191 Call* NewCall(Expression* expression, |
| 3169 ZoneList<Expression*>* arguments, | 3192 ZoneList<Expression*>* arguments, |
| 3170 int pos) { | 3193 int pos) { |
| 3171 Call* call = new(zone_) Call(isolate_, expression, arguments, pos); | 3194 Call* call = new(zone_) Call(zone_, expression, arguments, pos); |
| 3172 VISIT_AND_RETURN(Call, call) | 3195 VISIT_AND_RETURN(Call, call) |
| 3173 } | 3196 } |
| 3174 | 3197 |
| 3175 CallNew* NewCallNew(Expression* expression, | 3198 CallNew* NewCallNew(Expression* expression, |
| 3176 ZoneList<Expression*>* arguments, | 3199 ZoneList<Expression*>* arguments, |
| 3177 int pos) { | 3200 int pos) { |
| 3178 CallNew* call = new(zone_) CallNew(isolate_, expression, arguments, pos); | 3201 CallNew* call = new(zone_) CallNew(zone_, expression, arguments, pos); |
| 3179 VISIT_AND_RETURN(CallNew, call) | 3202 VISIT_AND_RETURN(CallNew, call) |
| 3180 } | 3203 } |
| 3181 | 3204 |
| 3182 CallRuntime* NewCallRuntime(Handle<String> name, | 3205 CallRuntime* NewCallRuntime(Handle<String> name, |
| 3183 const Runtime::Function* function, | 3206 const Runtime::Function* function, |
| 3184 ZoneList<Expression*>* arguments, | 3207 ZoneList<Expression*>* arguments, |
| 3185 int pos) { | 3208 int pos) { |
| 3186 CallRuntime* call = | 3209 CallRuntime* call = |
| 3187 new(zone_) CallRuntime(isolate_, name, function, arguments, pos); | 3210 new(zone_) CallRuntime(zone_, name, function, arguments, pos); |
| 3188 VISIT_AND_RETURN(CallRuntime, call) | 3211 VISIT_AND_RETURN(CallRuntime, call) |
| 3189 } | 3212 } |
| 3190 | 3213 |
| 3191 UnaryOperation* NewUnaryOperation(Token::Value op, | 3214 UnaryOperation* NewUnaryOperation(Token::Value op, |
| 3192 Expression* expression, | 3215 Expression* expression, |
| 3193 int pos) { | 3216 int pos) { |
| 3194 UnaryOperation* node = | 3217 UnaryOperation* node = |
| 3195 new(zone_) UnaryOperation(isolate_, op, expression, pos); | 3218 new(zone_) UnaryOperation(zone_, op, expression, pos); |
| 3196 VISIT_AND_RETURN(UnaryOperation, node) | 3219 VISIT_AND_RETURN(UnaryOperation, node) |
| 3197 } | 3220 } |
| 3198 | 3221 |
| 3199 BinaryOperation* NewBinaryOperation(Token::Value op, | 3222 BinaryOperation* NewBinaryOperation(Token::Value op, |
| 3200 Expression* left, | 3223 Expression* left, |
| 3201 Expression* right, | 3224 Expression* right, |
| 3202 int pos) { | 3225 int pos) { |
| 3203 BinaryOperation* node = | 3226 BinaryOperation* node = |
| 3204 new(zone_) BinaryOperation(isolate_, op, left, right, pos); | 3227 new(zone_) BinaryOperation(zone_, op, left, right, pos); |
| 3205 VISIT_AND_RETURN(BinaryOperation, node) | 3228 VISIT_AND_RETURN(BinaryOperation, node) |
| 3206 } | 3229 } |
| 3207 | 3230 |
| 3208 CountOperation* NewCountOperation(Token::Value op, | 3231 CountOperation* NewCountOperation(Token::Value op, |
| 3209 bool is_prefix, | 3232 bool is_prefix, |
| 3210 Expression* expr, | 3233 Expression* expr, |
| 3211 int pos) { | 3234 int pos) { |
| 3212 CountOperation* node = | 3235 CountOperation* node = |
| 3213 new(zone_) CountOperation(isolate_, op, is_prefix, expr, pos); | 3236 new(zone_) CountOperation(zone_, op, is_prefix, expr, pos); |
| 3214 VISIT_AND_RETURN(CountOperation, node) | 3237 VISIT_AND_RETURN(CountOperation, node) |
| 3215 } | 3238 } |
| 3216 | 3239 |
| 3217 CompareOperation* NewCompareOperation(Token::Value op, | 3240 CompareOperation* NewCompareOperation(Token::Value op, |
| 3218 Expression* left, | 3241 Expression* left, |
| 3219 Expression* right, | 3242 Expression* right, |
| 3220 int pos) { | 3243 int pos) { |
| 3221 CompareOperation* node = | 3244 CompareOperation* node = |
| 3222 new(zone_) CompareOperation(isolate_, op, left, right, pos); | 3245 new(zone_) CompareOperation(zone_, op, left, right, pos); |
| 3223 VISIT_AND_RETURN(CompareOperation, node) | 3246 VISIT_AND_RETURN(CompareOperation, node) |
| 3224 } | 3247 } |
| 3225 | 3248 |
| 3226 Conditional* NewConditional(Expression* condition, | 3249 Conditional* NewConditional(Expression* condition, |
| 3227 Expression* then_expression, | 3250 Expression* then_expression, |
| 3228 Expression* else_expression, | 3251 Expression* else_expression, |
| 3229 int position) { | 3252 int position) { |
| 3230 Conditional* cond = new(zone_) Conditional( | 3253 Conditional* cond = new(zone_) Conditional( |
| 3231 isolate_, condition, then_expression, else_expression, position); | 3254 zone_, condition, then_expression, else_expression, position); |
| 3232 VISIT_AND_RETURN(Conditional, cond) | 3255 VISIT_AND_RETURN(Conditional, cond) |
| 3233 } | 3256 } |
| 3234 | 3257 |
| 3235 Assignment* NewAssignment(Token::Value op, | 3258 Assignment* NewAssignment(Token::Value op, |
| 3236 Expression* target, | 3259 Expression* target, |
| 3237 Expression* value, | 3260 Expression* value, |
| 3238 int pos) { | 3261 int pos) { |
| 3239 Assignment* assign = | 3262 Assignment* assign = |
| 3240 new(zone_) Assignment(isolate_, op, target, value, pos); | 3263 new(zone_) Assignment(zone_, op, target, value, pos); |
| 3241 assign->Init(isolate_, this); | 3264 assign->Init(zone_, this); |
| 3242 VISIT_AND_RETURN(Assignment, assign) | 3265 VISIT_AND_RETURN(Assignment, assign) |
| 3243 } | 3266 } |
| 3244 | 3267 |
| 3245 Yield* NewYield(Expression *generator_object, | 3268 Yield* NewYield(Expression *generator_object, |
| 3246 Expression* expression, | 3269 Expression* expression, |
| 3247 Yield::Kind yield_kind, | 3270 Yield::Kind yield_kind, |
| 3248 int pos) { | 3271 int pos) { |
| 3249 Yield* yield = new(zone_) Yield( | 3272 Yield* yield = new(zone_) Yield( |
| 3250 isolate_, generator_object, expression, yield_kind, pos); | 3273 zone_, generator_object, expression, yield_kind, pos); |
| 3251 VISIT_AND_RETURN(Yield, yield) | 3274 VISIT_AND_RETURN(Yield, yield) |
| 3252 } | 3275 } |
| 3253 | 3276 |
| 3254 Throw* NewThrow(Expression* exception, int pos) { | 3277 Throw* NewThrow(Expression* exception, int pos) { |
| 3255 Throw* t = new(zone_) Throw(isolate_, exception, pos); | 3278 Throw* t = new(zone_) Throw(zone_, exception, pos); |
| 3256 VISIT_AND_RETURN(Throw, t) | 3279 VISIT_AND_RETURN(Throw, t) |
| 3257 } | 3280 } |
| 3258 | 3281 |
| 3259 FunctionLiteral* NewFunctionLiteral( | 3282 FunctionLiteral* NewFunctionLiteral( |
| 3260 Handle<String> name, | 3283 Handle<String> name, |
| 3261 Scope* scope, | 3284 Scope* scope, |
| 3262 ZoneList<Statement*>* body, | 3285 ZoneList<Statement*>* body, |
| 3263 int materialized_literal_count, | 3286 int materialized_literal_count, |
| 3264 int expected_property_count, | 3287 int expected_property_count, |
| 3265 int handler_count, | 3288 int handler_count, |
| 3266 int parameter_count, | 3289 int parameter_count, |
| 3267 FunctionLiteral::ParameterFlag has_duplicate_parameters, | 3290 FunctionLiteral::ParameterFlag has_duplicate_parameters, |
| 3268 FunctionLiteral::FunctionType function_type, | 3291 FunctionLiteral::FunctionType function_type, |
| 3269 FunctionLiteral::IsFunctionFlag is_function, | 3292 FunctionLiteral::IsFunctionFlag is_function, |
| 3270 FunctionLiteral::IsParenthesizedFlag is_parenthesized, | 3293 FunctionLiteral::IsParenthesizedFlag is_parenthesized, |
| 3271 FunctionLiteral::IsGeneratorFlag is_generator, | 3294 FunctionLiteral::IsGeneratorFlag is_generator, |
| 3272 int position) { | 3295 int position) { |
| 3273 FunctionLiteral* lit = new(zone_) FunctionLiteral( | 3296 FunctionLiteral* lit = new(zone_) FunctionLiteral( |
| 3274 isolate_, name, scope, body, | 3297 zone_, name, scope, body, |
| 3275 materialized_literal_count, expected_property_count, handler_count, | 3298 materialized_literal_count, expected_property_count, handler_count, |
| 3276 parameter_count, function_type, has_duplicate_parameters, is_function, | 3299 parameter_count, function_type, has_duplicate_parameters, is_function, |
| 3277 is_parenthesized, is_generator, position); | 3300 is_parenthesized, is_generator, position); |
| 3278 // Top-level literal doesn't count for the AST's properties. | 3301 // Top-level literal doesn't count for the AST's properties. |
| 3279 if (is_function == FunctionLiteral::kIsFunction) { | 3302 if (is_function == FunctionLiteral::kIsFunction) { |
| 3280 visitor_.VisitFunctionLiteral(lit); | 3303 visitor_.VisitFunctionLiteral(lit); |
| 3281 } | 3304 } |
| 3282 return lit; | 3305 return lit; |
| 3283 } | 3306 } |
| 3284 | 3307 |
| 3285 NativeFunctionLiteral* NewNativeFunctionLiteral( | 3308 NativeFunctionLiteral* NewNativeFunctionLiteral( |
| 3286 Handle<String> name, v8::Extension* extension, int pos) { | 3309 Handle<String> name, v8::Extension* extension, int pos) { |
| 3287 NativeFunctionLiteral* lit = | 3310 NativeFunctionLiteral* lit = |
| 3288 new(zone_) NativeFunctionLiteral(isolate_, name, extension, pos); | 3311 new(zone_) NativeFunctionLiteral(zone_, name, extension, pos); |
| 3289 VISIT_AND_RETURN(NativeFunctionLiteral, lit) | 3312 VISIT_AND_RETURN(NativeFunctionLiteral, lit) |
| 3290 } | 3313 } |
| 3291 | 3314 |
| 3292 ThisFunction* NewThisFunction(int pos) { | 3315 ThisFunction* NewThisFunction(int pos) { |
| 3293 ThisFunction* fun = new(zone_) ThisFunction(isolate_, pos); | 3316 ThisFunction* fun = new(zone_) ThisFunction(zone_, pos); |
| 3294 VISIT_AND_RETURN(ThisFunction, fun) | 3317 VISIT_AND_RETURN(ThisFunction, fun) |
| 3295 } | 3318 } |
| 3296 | 3319 |
| 3297 #undef VISIT_AND_RETURN | 3320 #undef VISIT_AND_RETURN |
| 3298 | 3321 |
| 3299 private: | 3322 private: |
| 3300 Isolate* isolate_; | |
| 3301 Zone* zone_; | 3323 Zone* zone_; |
| 3302 Visitor visitor_; | 3324 Visitor visitor_; |
| 3303 }; | 3325 }; |
| 3304 | 3326 |
| 3305 | 3327 |
| 3306 } } // namespace v8::internal | 3328 } } // namespace v8::internal |
| 3307 | 3329 |
| 3308 #endif // V8_AST_H_ | 3330 #endif // V8_AST_H_ |
| OLD | NEW |