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

Side by Side Diff: src/ast.cc

Issue 32643004: Add a soft-deopt in keyed element access when current IC is pre-monomorphic and no type feedback wa… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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/hydrogen.cc » ('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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 Expression* value, 132 Expression* value,
133 int pos) 133 int pos)
134 : Expression(isolate, pos), 134 : Expression(isolate, pos),
135 op_(op), 135 op_(op),
136 target_(target), 136 target_(target),
137 value_(value), 137 value_(value),
138 binary_operation_(NULL), 138 binary_operation_(NULL),
139 assignment_id_(GetNextId(isolate)), 139 assignment_id_(GetNextId(isolate)),
140 is_monomorphic_(false), 140 is_monomorphic_(false),
141 is_uninitialized_(false), 141 is_uninitialized_(false),
142 is_pre_monomorphic_(false),
142 store_mode_(STANDARD_STORE) { } 143 store_mode_(STANDARD_STORE) { }
143 144
144 145
145 Token::Value Assignment::binary_op() const { 146 Token::Value Assignment::binary_op() const {
146 switch (op_) { 147 switch (op_) {
147 case Token::ASSIGN_BIT_OR: return Token::BIT_OR; 148 case Token::ASSIGN_BIT_OR: return Token::BIT_OR;
148 case Token::ASSIGN_BIT_XOR: return Token::BIT_XOR; 149 case Token::ASSIGN_BIT_XOR: return Token::BIT_XOR;
149 case Token::ASSIGN_BIT_AND: return Token::BIT_AND; 150 case Token::ASSIGN_BIT_AND: return Token::BIT_AND;
150 case Token::ASSIGN_SHL: return Token::SHL; 151 case Token::ASSIGN_SHL: return Token::SHL;
151 case Token::ASSIGN_SAR: return Token::SAR; 152 case Token::ASSIGN_SAR: return Token::SAR;
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 to_boolean_types_ = oracle->ToBooleanTypes(test_id()); 420 to_boolean_types_ = oracle->ToBooleanTypes(test_id());
420 } 421 }
421 422
422 423
423 void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle, 424 void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle,
424 Zone* zone) { 425 Zone* zone) {
425 // Record type feedback from the oracle in the AST. 426 // Record type feedback from the oracle in the AST.
426 is_uninitialized_ = oracle->LoadIsUninitialized(this); 427 is_uninitialized_ = oracle->LoadIsUninitialized(this);
427 if (is_uninitialized_) return; 428 if (is_uninitialized_) return;
428 429
430 is_pre_monomorphic_ = oracle->LoadIsPreMonomorphic(this);
429 is_monomorphic_ = oracle->LoadIsMonomorphicNormal(this); 431 is_monomorphic_ = oracle->LoadIsMonomorphicNormal(this);
432 ASSERT(!is_pre_monomorphic_ || !is_monomorphic_);
430 receiver_types_.Clear(); 433 receiver_types_.Clear();
431 if (key()->IsPropertyName()) { 434 if (key()->IsPropertyName()) {
432 FunctionPrototypeStub proto_stub(Code::LOAD_IC); 435 FunctionPrototypeStub proto_stub(Code::LOAD_IC);
433 if (oracle->LoadIsStub(this, &proto_stub)) { 436 if (oracle->LoadIsStub(this, &proto_stub)) {
434 is_function_prototype_ = true; 437 is_function_prototype_ = true;
435 } else { 438 } else {
436 Literal* lit_key = key()->AsLiteral(); 439 Literal* lit_key = key()->AsLiteral();
437 ASSERT(lit_key != NULL && lit_key->value()->IsString()); 440 ASSERT(lit_key != NULL && lit_key->value()->IsString());
438 Handle<String> name = Handle<String>::cast(lit_key->value()); 441 Handle<String> name = Handle<String>::cast(lit_key->value());
439 oracle->LoadReceiverTypes(this, name, &receiver_types_); 442 oracle->LoadReceiverTypes(this, name, &receiver_types_);
440 } 443 }
441 } else if (oracle->LoadIsBuiltin(this, Builtins::kKeyedLoadIC_String)) { 444 } else if (oracle->LoadIsBuiltin(this, Builtins::kKeyedLoadIC_String)) {
442 is_string_access_ = true; 445 is_string_access_ = true;
443 } else if (is_monomorphic_) { 446 } else if (is_monomorphic_) {
444 receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this), zone); 447 receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this), zone);
445 } else if (oracle->LoadIsPolymorphic(this)) { 448 } else if (oracle->LoadIsPolymorphic(this)) {
446 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone); 449 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone);
447 oracle->CollectKeyedReceiverTypes(PropertyFeedbackId(), &receiver_types_); 450 oracle->CollectKeyedReceiverTypes(PropertyFeedbackId(), &receiver_types_);
448 } 451 }
449 } 452 }
450 453
451 454
452 void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle, 455 void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle,
453 Zone* zone) { 456 Zone* zone) {
454 Property* prop = target()->AsProperty(); 457 Property* prop = target()->AsProperty();
455 ASSERT(prop != NULL); 458 ASSERT(prop != NULL);
456 TypeFeedbackId id = AssignmentFeedbackId(); 459 TypeFeedbackId id = AssignmentFeedbackId();
457 is_uninitialized_ = oracle->StoreIsUninitialized(id); 460 is_uninitialized_ = oracle->StoreIsUninitialized(id);
458 if (is_uninitialized_) return; 461 if (is_uninitialized_) return;
462
463 is_pre_monomorphic_ = oracle->StoreIsPreMonomorphic(id);
459 is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id); 464 is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id);
465 ASSERT(!is_pre_monomorphic_ || !is_monomorphic_);
460 receiver_types_.Clear(); 466 receiver_types_.Clear();
461 if (prop->key()->IsPropertyName()) { 467 if (prop->key()->IsPropertyName()) {
462 Literal* lit_key = prop->key()->AsLiteral(); 468 Literal* lit_key = prop->key()->AsLiteral();
463 ASSERT(lit_key != NULL && lit_key->value()->IsString()); 469 ASSERT(lit_key != NULL && lit_key->value()->IsString());
464 Handle<String> name = Handle<String>::cast(lit_key->value()); 470 Handle<String> name = Handle<String>::cast(lit_key->value());
465 oracle->StoreReceiverTypes(this, name, &receiver_types_); 471 oracle->StoreReceiverTypes(this, name, &receiver_types_);
466 } else if (is_monomorphic_) { 472 } else if (is_monomorphic_) {
467 // Record receiver type for monomorphic keyed stores. 473 // Record receiver type for monomorphic keyed stores.
468 receiver_types_.Add(oracle->StoreMonomorphicReceiverType(id), zone); 474 receiver_types_.Add(oracle->StoreMonomorphicReceiverType(id), zone);
469 store_mode_ = oracle->GetStoreMode(id); 475 store_mode_ = oracle->GetStoreMode(id);
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); 1163 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value());
1158 str = arr; 1164 str = arr;
1159 } else { 1165 } else {
1160 str = DoubleToCString(value_->Number(), buffer); 1166 str = DoubleToCString(value_->Number(), buffer);
1161 } 1167 }
1162 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); 1168 return isolate_->factory()->NewStringFromAscii(CStrVector(str));
1163 } 1169 }
1164 1170
1165 1171
1166 } } // namespace v8::internal 1172 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698