Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 op_ = assignment->binary_op(); | 342 op_ = assignment->binary_op(); |
| 343 left_ = assignment->target(); | 343 left_ = assignment->target(); |
| 344 right_ = assignment->value(); | 344 right_ = assignment->value(); |
| 345 pos_ = assignment->position(); | 345 pos_ = assignment->position(); |
| 346 } | 346 } |
| 347 | 347 |
| 348 | 348 |
| 349 // ---------------------------------------------------------------------------- | 349 // ---------------------------------------------------------------------------- |
| 350 // Inlining support | 350 // Inlining support |
| 351 | 351 |
| 352 bool Declaration::IsInlineable() const { | |
| 353 return false; | |
| 354 } | |
| 355 | |
| 356 | |
| 352 bool Block::IsInlineable() const { | 357 bool Block::IsInlineable() const { |
| 353 const int count = statements_.length(); | 358 const int count = statements_.length(); |
| 354 for (int i = 0; i < count; ++i) { | 359 for (int i = 0; i < count; ++i) { |
| 355 if (!statements_[i]->IsInlineable()) return false; | 360 if (!statements_[i]->IsInlineable()) return false; |
| 356 } | 361 } |
| 357 return true; | 362 return true; |
| 358 } | 363 } |
| 359 | 364 |
| 360 | 365 |
| 361 bool ExpressionStatement::IsInlineable() const { | 366 bool ExpressionStatement::IsInlineable() const { |
| 362 return expression()->IsInlineable(); | 367 return expression()->IsInlineable(); |
| 363 } | 368 } |
| 364 | 369 |
| 365 | 370 |
| 366 bool IfStatement::IsInlineable() const { | 371 bool IfStatement::IsInlineable() const { |
| 367 return condition()->IsInlineable() && then_statement()->IsInlineable() && | 372 return condition()->IsInlineable() |
| 368 else_statement()->IsInlineable(); | 373 && then_statement()->IsInlineable() |
| 374 && else_statement()->IsInlineable(); | |
| 375 } | |
| 376 | |
| 377 | |
| 378 bool ForStatement::IsInlineable() const { | |
| 379 return false; | |
|
Kevin Millikin (Chromium)
2011/04/12 07:23:00
It won't stay sorted, but I think it's easiest to
| |
| 380 } | |
| 381 | |
| 382 | |
| 383 bool WhileStatement::IsInlineable() const { | |
| 384 return false; | |
| 385 } | |
| 386 | |
| 387 | |
| 388 bool DoWhileStatement::IsInlineable() const { | |
| 389 return false; | |
| 390 } | |
| 391 | |
| 392 | |
| 393 bool ForInStatement::IsInlineable() const { | |
| 394 return false; | |
| 395 } | |
| 396 | |
| 397 | |
| 398 bool ContinueStatement::IsInlineable() const { | |
| 399 return false; | |
| 400 } | |
| 401 | |
| 402 | |
| 403 bool BreakStatement::IsInlineable() const { | |
| 404 return false; | |
| 369 } | 405 } |
| 370 | 406 |
| 371 | 407 |
| 372 bool ReturnStatement::IsInlineable() const { | 408 bool ReturnStatement::IsInlineable() const { |
| 373 return expression()->IsInlineable(); | 409 return expression()->IsInlineable(); |
| 374 } | 410 } |
| 375 | 411 |
| 376 | 412 |
| 413 bool WithEnterStatement::IsInlineable() const { | |
| 414 return false; | |
| 415 } | |
| 416 | |
| 417 | |
| 418 bool WithExitStatement::IsInlineable() const { | |
| 419 return false; | |
| 420 } | |
| 421 | |
| 422 | |
| 423 bool SwitchStatement::IsInlineable() const { | |
| 424 return false; | |
| 425 } | |
| 426 | |
| 427 | |
| 428 bool TargetCollector::IsInlineable() const { | |
| 429 return false; | |
| 430 } | |
| 431 | |
| 432 bool TryStatement::IsInlineable() const { | |
| 433 return false; | |
| 434 } | |
| 435 | |
| 436 | |
| 437 bool TryCatchStatement::IsInlineable() const { | |
| 438 return false; | |
| 439 } | |
| 440 | |
| 441 | |
| 442 bool TryFinallyStatement::IsInlineable() const { | |
| 443 return false; | |
| 444 } | |
| 445 | |
| 446 | |
| 447 bool DebuggerStatement::IsInlineable() const { | |
| 448 return false; | |
| 449 } | |
| 450 | |
| 451 | |
| 452 bool EmptyStatement::IsInlineable() const { | |
| 453 return true; | |
| 454 } | |
| 455 | |
| 456 | |
| 457 bool Literal::IsInlineable() const { | |
| 458 return true; | |
| 459 } | |
| 460 | |
| 461 | |
| 462 bool MaterializedLiteral::IsInlineable() const { | |
| 463 return false; | |
| 464 } | |
| 465 | |
| 466 | |
| 467 bool CatchExtensionObject::IsInlineable() const { | |
| 468 return false; | |
| 469 } | |
| 470 | |
| 471 | |
| 472 bool Slot::IsInlineable() const { | |
| 473 UNREACHABLE(); | |
| 474 return false; | |
| 475 } | |
| 476 | |
| 477 | |
| 377 bool Conditional::IsInlineable() const { | 478 bool Conditional::IsInlineable() const { |
| 378 return condition()->IsInlineable() && then_expression()->IsInlineable() && | 479 return condition()->IsInlineable() && then_expression()->IsInlineable() && |
| 379 else_expression()->IsInlineable(); | 480 else_expression()->IsInlineable(); |
| 380 } | 481 } |
| 381 | 482 |
| 382 | 483 |
| 383 bool VariableProxy::IsInlineable() const { | 484 bool VariableProxy::IsInlineable() const { |
| 384 return var()->is_global() || var()->IsStackAllocated(); | 485 return var()->is_global() || var()->IsStackAllocated(); |
| 385 } | 486 } |
| 386 | 487 |
| 387 | 488 |
| 388 bool Assignment::IsInlineable() const { | 489 bool Assignment::IsInlineable() const { |
| 389 return target()->IsInlineable() && value()->IsInlineable(); | 490 return target()->IsInlineable() && value()->IsInlineable(); |
| 390 } | 491 } |
| 391 | 492 |
| 392 | 493 |
| 494 bool Throw::IsInlineable() const { | |
| 495 return false; | |
| 496 } | |
| 497 | |
| 498 | |
| 499 bool FunctionLiteral::IsInlineable() const { | |
| 500 return false; | |
| 501 } | |
| 502 | |
| 503 | |
| 504 bool ThisFunction::IsInlineable() const { | |
| 505 return false; | |
| 506 } | |
| 507 | |
| 508 | |
| 509 bool SharedFunctionInfoLiteral::IsInlineable() const { | |
| 510 return false; | |
| 511 } | |
| 512 | |
| 513 | |
| 393 bool Property::IsInlineable() const { | 514 bool Property::IsInlineable() const { |
| 394 return obj()->IsInlineable() && key()->IsInlineable(); | 515 return obj()->IsInlineable() && key()->IsInlineable(); |
| 395 } | 516 } |
| 396 | 517 |
| 397 | 518 |
| 398 bool Call::IsInlineable() const { | 519 bool Call::IsInlineable() const { |
| 399 if (!expression()->IsInlineable()) return false; | 520 if (!expression()->IsInlineable()) return false; |
| 400 const int count = arguments()->length(); | 521 const int count = arguments()->length(); |
| 401 for (int i = 0; i < count; ++i) { | 522 for (int i = 0; i < count; ++i) { |
| 402 if (!arguments()->at(i)->IsInlineable()) return false; | 523 if (!arguments()->at(i)->IsInlineable()) return false; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 442 bool CompareToNull::IsInlineable() const { | 563 bool CompareToNull::IsInlineable() const { |
| 443 return expression()->IsInlineable(); | 564 return expression()->IsInlineable(); |
| 444 } | 565 } |
| 445 | 566 |
| 446 | 567 |
| 447 bool CountOperation::IsInlineable() const { | 568 bool CountOperation::IsInlineable() const { |
| 448 return expression()->IsInlineable(); | 569 return expression()->IsInlineable(); |
| 449 } | 570 } |
| 450 | 571 |
| 451 | 572 |
| 573 bool ValidLeftHandSideSentinel::IsInlineable() const { | |
| 574 UNREACHABLE(); | |
| 575 return false; | |
| 576 } | |
| 577 | |
| 578 | |
| 452 // ---------------------------------------------------------------------------- | 579 // ---------------------------------------------------------------------------- |
| 453 // Recording of type feedback | 580 // Recording of type feedback |
| 454 | 581 |
| 455 void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle) { | 582 void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle) { |
| 456 // Record type feedback from the oracle in the AST. | 583 // Record type feedback from the oracle in the AST. |
| 457 is_monomorphic_ = oracle->LoadIsMonomorphic(this); | 584 is_monomorphic_ = oracle->LoadIsMonomorphic(this); |
| 458 if (key()->IsPropertyName()) { | 585 if (key()->IsPropertyName()) { |
| 459 if (oracle->LoadIsBuiltin(this, Builtins::kLoadIC_ArrayLength)) { | 586 if (oracle->LoadIsBuiltin(this, Builtins::kLoadIC_ArrayLength)) { |
| 460 is_array_length_ = true; | 587 is_array_length_ = true; |
| 461 } else if (oracle->LoadIsBuiltin(this, Builtins::kLoadIC_StringLength)) { | 588 } else if (oracle->LoadIsBuiltin(this, Builtins::kLoadIC_StringLength)) { |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1007 ZoneList<Statement*>* statements, | 1134 ZoneList<Statement*>* statements, |
| 1008 int pos) | 1135 int pos) |
| 1009 : label_(label), | 1136 : label_(label), |
| 1010 statements_(statements), | 1137 statements_(statements), |
| 1011 position_(pos), | 1138 position_(pos), |
| 1012 compare_type_(NONE), | 1139 compare_type_(NONE), |
| 1013 entry_id_(AstNode::GetNextId()) { | 1140 entry_id_(AstNode::GetNextId()) { |
| 1014 } | 1141 } |
| 1015 | 1142 |
| 1016 } } // namespace v8::internal | 1143 } } // namespace v8::internal |
| OLD | NEW |