| OLD | NEW | 
|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 24 matching lines...) Expand all  Loading... | 
| 35 namespace v8 { | 35 namespace v8 { | 
| 36 namespace internal { | 36 namespace internal { | 
| 37 | 37 | 
| 38 | 38 | 
| 39 AstTyper::AstTyper(CompilationInfo* info) | 39 AstTyper::AstTyper(CompilationInfo* info) | 
| 40     : info_(info), | 40     : info_(info), | 
| 41       oracle_( | 41       oracle_( | 
| 42           Handle<Code>(info->closure()->shared()->code()), | 42           Handle<Code>(info->closure()->shared()->code()), | 
| 43           Handle<Context>(info->closure()->context()->native_context()), | 43           Handle<Context>(info->closure()->context()->native_context()), | 
| 44           info->zone()), | 44           info->zone()), | 
| 45       store_(info->zone()) { | 45       store_(info->zone()), | 
|  | 46       current_feedback_slot_(0) { | 
| 46   InitializeAstVisitor(info->zone()); | 47   InitializeAstVisitor(info->zone()); | 
| 47 } | 48 } | 
| 48 | 49 | 
| 49 | 50 | 
| 50 #define RECURSE(call)                         \ | 51 #define RECURSE(call)                         \ | 
| 51   do {                                        \ | 52   do {                                        \ | 
| 52     ASSERT(!visitor->HasStackOverflow());     \ | 53     ASSERT(!visitor->HasStackOverflow());     \ | 
| 53     call;                                     \ | 54     call;                                     \ | 
| 54     if (visitor->HasStackOverflow()) return;  \ | 55     if (visitor->HasStackOverflow()) return;  \ | 
| 55   } while (false) | 56   } while (false) | 
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 315   if (stmt->next() != NULL) { | 316   if (stmt->next() != NULL) { | 
| 316     store_.Forget();  // Control may transfer here via 'continue'. | 317     store_.Forget();  // Control may transfer here via 'continue'. | 
| 317     RECURSE(Visit(stmt->next())); | 318     RECURSE(Visit(stmt->next())); | 
| 318   } | 319   } | 
| 319   store_.Forget();  // Control may transfer here via termination or 'break'. | 320   store_.Forget();  // Control may transfer here via termination or 'break'. | 
| 320 } | 321 } | 
| 321 | 322 | 
| 322 | 323 | 
| 323 void AstTyper::VisitForInStatement(ForInStatement* stmt) { | 324 void AstTyper::VisitForInStatement(ForInStatement* stmt) { | 
| 324   // Collect type feedback. | 325   // Collect type feedback. | 
|  | 326   InitializeFeedbackSlots(stmt); | 
| 325   stmt->set_for_in_type(static_cast<ForInStatement::ForInType>( | 327   stmt->set_for_in_type(static_cast<ForInStatement::ForInType>( | 
| 326       oracle()->ForInType(stmt->ForInFeedbackId()))); | 328       oracle()->ForInType(stmt->ForInFeedbackSlot()))); | 
| 327 | 329 | 
| 328   RECURSE(Visit(stmt->enumerable())); | 330   RECURSE(Visit(stmt->enumerable())); | 
| 329   store_.Forget();  // Control may transfer here via looping or 'continue'. | 331   store_.Forget();  // Control may transfer here via looping or 'continue'. | 
| 330   ObserveTypesAtOsrEntry(stmt); | 332   ObserveTypesAtOsrEntry(stmt); | 
| 331   RECURSE(Visit(stmt->body())); | 333   RECURSE(Visit(stmt->body())); | 
| 332   store_.Forget();  // Control may transfer here via 'break'. | 334   store_.Forget();  // Control may transfer here via 'break'. | 
| 333 } | 335 } | 
| 334 | 336 | 
| 335 | 337 | 
| 336 void AstTyper::VisitForOfStatement(ForOfStatement* stmt) { | 338 void AstTyper::VisitForOfStatement(ForOfStatement* stmt) { | 
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 524   } | 526   } | 
| 525 | 527 | 
| 526   RECURSE(Visit(expr->obj())); | 528   RECURSE(Visit(expr->obj())); | 
| 527   RECURSE(Visit(expr->key())); | 529   RECURSE(Visit(expr->key())); | 
| 528 | 530 | 
| 529   // We don't know anything about the result type. | 531   // We don't know anything about the result type. | 
| 530 } | 532 } | 
| 531 | 533 | 
| 532 | 534 | 
| 533 void AstTyper::VisitCall(Call* expr) { | 535 void AstTyper::VisitCall(Call* expr) { | 
|  | 536   InitializeFeedbackSlots(expr); | 
|  | 537 | 
| 534   // Collect type feedback. | 538   // Collect type feedback. | 
| 535   expr->RecordTypeFeedback(oracle()); | 539   expr->RecordTypeFeedback(oracle()); | 
| 536 | 540 | 
| 537   RECURSE(Visit(expr->expression())); | 541   RECURSE(Visit(expr->expression())); | 
| 538   ZoneList<Expression*>* args = expr->arguments(); | 542   ZoneList<Expression*>* args = expr->arguments(); | 
| 539   for (int i = 0; i < args->length(); ++i) { | 543   for (int i = 0; i < args->length(); ++i) { | 
| 540     Expression* arg = args->at(i); | 544     Expression* arg = args->at(i); | 
| 541     RECURSE(Visit(arg)); | 545     RECURSE(Visit(arg)); | 
| 542   } | 546   } | 
| 543 | 547 | 
| 544   VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 548   VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 
| 545   if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { | 549   if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { | 
| 546     store_.Forget();  // Eval could do whatever to local variables. | 550     store_.Forget();  // Eval could do whatever to local variables. | 
| 547   } | 551   } | 
| 548 | 552 | 
| 549   // We don't know anything about the result type. | 553   // We don't know anything about the result type. | 
| 550 } | 554 } | 
| 551 | 555 | 
| 552 | 556 | 
|  | 557 void AstTyper::InitializeFeedbackSlots(AstNode* expr) { | 
|  | 558   current_feedback_slot_ = expr->ConsumeFeedbackSlots( | 
|  | 559       isolate(), current_feedback_slot_); | 
|  | 560 } | 
|  | 561 | 
|  | 562 | 
| 553 void AstTyper::VisitCallNew(CallNew* expr) { | 563 void AstTyper::VisitCallNew(CallNew* expr) { | 
|  | 564   InitializeFeedbackSlots(expr); | 
|  | 565 | 
| 554   // Collect type feedback. | 566   // Collect type feedback. | 
| 555   expr->RecordTypeFeedback(oracle()); | 567   expr->RecordTypeFeedback(oracle()); | 
| 556 | 568 | 
| 557   RECURSE(Visit(expr->expression())); | 569   RECURSE(Visit(expr->expression())); | 
| 558   ZoneList<Expression*>* args = expr->arguments(); | 570   ZoneList<Expression*>* args = expr->arguments(); | 
| 559   for (int i = 0; i < args->length(); ++i) { | 571   for (int i = 0; i < args->length(); ++i) { | 
| 560     Expression* arg = args->at(i); | 572     Expression* arg = args->at(i); | 
| 561     RECURSE(Visit(arg)); | 573     RECURSE(Visit(arg)); | 
| 562   } | 574   } | 
| 563 | 575 | 
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 791 void AstTyper::VisitModuleUrl(ModuleUrl* module) { | 803 void AstTyper::VisitModuleUrl(ModuleUrl* module) { | 
| 792 } | 804 } | 
| 793 | 805 | 
| 794 | 806 | 
| 795 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { | 807 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { | 
| 796   RECURSE(Visit(stmt->body())); | 808   RECURSE(Visit(stmt->body())); | 
| 797 } | 809 } | 
| 798 | 810 | 
| 799 | 811 | 
| 800 } }  // namespace v8::internal | 812 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|