OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/typing.h" | 5 #include "src/typing.h" |
6 | 6 |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 #include "src/frames-inl.h" | 8 #include "src/frames-inl.h" |
9 #include "src/ostreams.h" | 9 #include "src/ostreams.h" |
10 #include "src/parser.h" // for CompileTimeValue; TODO(rossberg): should move | 10 #include "src/parser.h" // for CompileTimeValue; TODO(rossberg): should move |
11 #include "src/scopes.h" | 11 #include "src/scopes.h" |
12 #include "src/splay-tree-inl.h" | 12 #include "src/splay-tree-inl.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 | 17 |
18 AstTyper::AstTyper(Isolate* isolate, Zone* zone, Handle<JSFunction> closure, | 18 AstTyper::AstTyper(Isolate* isolate, Zone* zone, Handle<JSFunction> closure, |
19 Scope* scope, BailoutId osr_ast_id, FunctionLiteral* root) | 19 Scope* scope, BailoutId osr_ast_id, FunctionLiteral* root) |
20 : closure_(closure), | 20 : isolate_(isolate), |
| 21 closure_(closure), |
21 scope_(scope), | 22 scope_(scope), |
22 osr_ast_id_(osr_ast_id), | 23 osr_ast_id_(osr_ast_id), |
23 root_(root), | 24 root_(root), |
24 oracle_(isolate, zone, handle(closure->shared()->code()), | 25 oracle_(isolate, zone, handle(closure->shared()->code()), |
25 handle(closure->shared()->feedback_vector()), | 26 handle(closure->shared()->feedback_vector()), |
26 handle(closure->context()->native_context())), | 27 handle(closure->context()->native_context())), |
27 store_(zone) { | 28 store_(zone) { |
28 InitializeAstVisitor(isolate, zone); | 29 InitializeAstVisitor(isolate, zone); |
29 } | 30 } |
30 | 31 |
(...skipping 13 matching lines...) Expand all Loading... |
44 Effect AstTyper::ObservedOnStack(Object* value) { | 45 Effect AstTyper::ObservedOnStack(Object* value) { |
45 Type* lower = Type::NowOf(value, zone()); | 46 Type* lower = Type::NowOf(value, zone()); |
46 return Effect(Bounds(lower, Type::Any(zone()))); | 47 return Effect(Bounds(lower, Type::Any(zone()))); |
47 } | 48 } |
48 | 49 |
49 | 50 |
50 void AstTyper::ObserveTypesAtOsrEntry(IterationStatement* stmt) { | 51 void AstTyper::ObserveTypesAtOsrEntry(IterationStatement* stmt) { |
51 if (stmt->OsrEntryId() != osr_ast_id_) return; | 52 if (stmt->OsrEntryId() != osr_ast_id_) return; |
52 | 53 |
53 DisallowHeapAllocation no_gc; | 54 DisallowHeapAllocation no_gc; |
54 JavaScriptFrameIterator it(isolate()); | 55 JavaScriptFrameIterator it(isolate_); |
55 JavaScriptFrame* frame = it.frame(); | 56 JavaScriptFrame* frame = it.frame(); |
56 | 57 |
57 // Assert that the frame on the stack belongs to the function we want to OSR. | 58 // Assert that the frame on the stack belongs to the function we want to OSR. |
58 DCHECK_EQ(*closure_, frame->function()); | 59 DCHECK_EQ(*closure_, frame->function()); |
59 | 60 |
60 int params = scope_->num_parameters(); | 61 int params = scope_->num_parameters(); |
61 int locals = scope_->StackLocalCount(); | 62 int locals = scope_->StackLocalCount(); |
62 | 63 |
63 // Use sequential composition to achieve desired narrowing. | 64 // Use sequential composition to achieve desired narrowing. |
64 // The receiver is a parameter with index -1. | 65 // The receiver is a parameter with index -1. |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 RECURSE(Visit(expr->key())); | 523 RECURSE(Visit(expr->key())); |
523 | 524 |
524 // We don't know anything about the result type. | 525 // We don't know anything about the result type. |
525 } | 526 } |
526 | 527 |
527 | 528 |
528 void AstTyper::VisitCall(Call* expr) { | 529 void AstTyper::VisitCall(Call* expr) { |
529 // Collect type feedback. | 530 // Collect type feedback. |
530 RECURSE(Visit(expr->expression())); | 531 RECURSE(Visit(expr->expression())); |
531 bool is_uninitialized = true; | 532 bool is_uninitialized = true; |
532 if (expr->IsUsingCallFeedbackICSlot(isolate())) { | 533 if (expr->IsUsingCallFeedbackICSlot(isolate_)) { |
533 FeedbackVectorSlot slot = expr->CallFeedbackICSlot(); | 534 FeedbackVectorSlot slot = expr->CallFeedbackICSlot(); |
534 is_uninitialized = oracle()->CallIsUninitialized(slot); | 535 is_uninitialized = oracle()->CallIsUninitialized(slot); |
535 if (!expr->expression()->IsProperty() && | 536 if (!expr->expression()->IsProperty() && |
536 oracle()->CallIsMonomorphic(slot)) { | 537 oracle()->CallIsMonomorphic(slot)) { |
537 expr->set_target(oracle()->GetCallTarget(slot)); | 538 expr->set_target(oracle()->GetCallTarget(slot)); |
538 Handle<AllocationSite> site = oracle()->GetCallAllocationSite(slot); | 539 Handle<AllocationSite> site = oracle()->GetCallAllocationSite(slot); |
539 expr->set_allocation_site(site); | 540 expr->set_allocation_site(site); |
540 } | 541 } |
541 } | 542 } |
542 | 543 |
543 expr->set_is_uninitialized(is_uninitialized); | 544 expr->set_is_uninitialized(is_uninitialized); |
544 | 545 |
545 ZoneList<Expression*>* args = expr->arguments(); | 546 ZoneList<Expression*>* args = expr->arguments(); |
546 for (int i = 0; i < args->length(); ++i) { | 547 for (int i = 0; i < args->length(); ++i) { |
547 Expression* arg = args->at(i); | 548 Expression* arg = args->at(i); |
548 RECURSE(Visit(arg)); | 549 RECURSE(Visit(arg)); |
549 } | 550 } |
550 | 551 |
551 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 552 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
552 if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { | 553 if (proxy != NULL && proxy->var()->is_possibly_eval(isolate_)) { |
553 store_.Forget(); // Eval could do whatever to local variables. | 554 store_.Forget(); // Eval could do whatever to local variables. |
554 } | 555 } |
555 | 556 |
556 // We don't know anything about the result type. | 557 // We don't know anything about the result type. |
557 } | 558 } |
558 | 559 |
559 | 560 |
560 void AstTyper::VisitCallNew(CallNew* expr) { | 561 void AstTyper::VisitCallNew(CallNew* expr) { |
561 // Collect type feedback. | 562 // Collect type feedback. |
562 FeedbackVectorSlot allocation_site_feedback_slot = | 563 FeedbackVectorSlot allocation_site_feedback_slot = |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 void AstTyper::VisitImportDeclaration(ImportDeclaration* declaration) { | 805 void AstTyper::VisitImportDeclaration(ImportDeclaration* declaration) { |
805 } | 806 } |
806 | 807 |
807 | 808 |
808 void AstTyper::VisitExportDeclaration(ExportDeclaration* declaration) { | 809 void AstTyper::VisitExportDeclaration(ExportDeclaration* declaration) { |
809 } | 810 } |
810 | 811 |
811 | 812 |
812 } // namespace internal | 813 } // namespace internal |
813 } // namespace v8 | 814 } // namespace v8 |
OLD | NEW |