Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: src/ast.cc

Issue 95163002: Move more logic from AST to oracle, pt 2 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ast.h ('k') | src/type-info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 573
574 // TODO(rossberg): all RecordTypeFeedback functions should disappear 574 // TODO(rossberg): all RecordTypeFeedback functions should disappear
575 // once we use the common type field in the AST consistently. 575 // once we use the common type field in the AST consistently.
576 576
577 577
578 void Expression::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) { 578 void Expression::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) {
579 to_boolean_types_ = oracle->ToBooleanTypes(test_id()); 579 to_boolean_types_ = oracle->ToBooleanTypes(test_id());
580 } 580 }
581 581
582 582
583 void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle,
584 Zone* zone) {
585 // Record type feedback from the oracle in the AST.
586 is_uninitialized_ = oracle->LoadIsUninitialized(this);
587 if (is_uninitialized_) return;
588
589 is_pre_monomorphic_ = oracle->LoadIsPreMonomorphic(this);
590 is_monomorphic_ = oracle->LoadIsMonomorphicNormal(this);
591 ASSERT(!is_pre_monomorphic_ || !is_monomorphic_);
592 receiver_types_.Clear();
593 if (key()->IsPropertyName()) {
594 FunctionPrototypeStub proto_stub(Code::LOAD_IC);
595 if (oracle->LoadIsStub(this, &proto_stub)) {
596 is_function_prototype_ = true;
597 } else {
598 Literal* lit_key = key()->AsLiteral();
599 ASSERT(lit_key != NULL && lit_key->value()->IsString());
600 Handle<String> name = Handle<String>::cast(lit_key->value());
601 oracle->LoadReceiverTypes(this, name, &receiver_types_);
602 }
603 } else if (oracle->LoadIsBuiltin(this, Builtins::kKeyedLoadIC_String)) {
604 is_string_access_ = true;
605 } else if (is_monomorphic_) {
606 receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this), zone);
607 } else if (oracle->LoadIsPolymorphic(this)) {
608 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone);
609 oracle->CollectKeyedReceiverTypes(PropertyFeedbackId(), &receiver_types_);
610 }
611 }
612
613
614 void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle, 583 void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle,
615 Zone* zone) { 584 Zone* zone) {
616 Property* prop = target()->AsProperty(); 585 Property* prop = target()->AsProperty();
617 ASSERT(prop != NULL); 586 ASSERT(prop != NULL);
618 TypeFeedbackId id = AssignmentFeedbackId(); 587 TypeFeedbackId id = AssignmentFeedbackId();
619 is_uninitialized_ = oracle->StoreIsUninitialized(id); 588 is_uninitialized_ = oracle->StoreIsUninitialized(id);
620 if (is_uninitialized_) return; 589 if (is_uninitialized_) return;
621 590
622 is_pre_monomorphic_ = oracle->StoreIsPreMonomorphic(id); 591 is_pre_monomorphic_ = oracle->StoreIsPreMonomorphic(id);
623 is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id); 592 is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id);
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); 1270 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value());
1302 str = arr; 1271 str = arr;
1303 } else { 1272 } else {
1304 str = DoubleToCString(value_->Number(), buffer); 1273 str = DoubleToCString(value_->Number(), buffer);
1305 } 1274 }
1306 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); 1275 return isolate_->factory()->NewStringFromAscii(CStrVector(str));
1307 } 1276 }
1308 1277
1309 1278
1310 } } // namespace v8::internal 1279 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/type-info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698