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

Side by Side Diff: src/ast.cc

Issue 32263002: 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, 2 months 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_) ||
433 (!is_pre_monomorphic_ && is_monomorphic_));
430 receiver_types_.Clear(); 434 receiver_types_.Clear();
431 if (key()->IsPropertyName()) { 435 if (key()->IsPropertyName()) {
432 FunctionPrototypeStub proto_stub(Code::LOAD_IC); 436 FunctionPrototypeStub proto_stub(Code::LOAD_IC);
433 if (oracle->LoadIsStub(this, &proto_stub)) { 437 if (oracle->LoadIsStub(this, &proto_stub)) {
434 is_function_prototype_ = true; 438 is_function_prototype_ = true;
435 } else { 439 } else {
436 Literal* lit_key = key()->AsLiteral(); 440 Literal* lit_key = key()->AsLiteral();
437 ASSERT(lit_key != NULL && lit_key->value()->IsString()); 441 ASSERT(lit_key != NULL && lit_key->value()->IsString());
438 Handle<String> name = Handle<String>::cast(lit_key->value()); 442 Handle<String> name = Handle<String>::cast(lit_key->value());
439 oracle->LoadReceiverTypes(this, name, &receiver_types_); 443 oracle->LoadReceiverTypes(this, name, &receiver_types_);
440 } 444 }
441 } else if (oracle->LoadIsBuiltin(this, Builtins::kKeyedLoadIC_String)) { 445 } else if (oracle->LoadIsBuiltin(this, Builtins::kKeyedLoadIC_String)) {
442 is_string_access_ = true; 446 is_string_access_ = true;
443 } else if (is_monomorphic_) { 447 } else if (is_monomorphic_) {
444 receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this), zone); 448 receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this), zone);
445 } else if (oracle->LoadIsPolymorphic(this)) { 449 } else if (oracle->LoadIsPolymorphic(this)) {
446 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone); 450 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone);
447 oracle->CollectKeyedReceiverTypes(PropertyFeedbackId(), &receiver_types_); 451 oracle->CollectKeyedReceiverTypes(PropertyFeedbackId(), &receiver_types_);
448 } 452 }
449 } 453 }
450 454
451 455
452 void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle, 456 void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle,
453 Zone* zone) { 457 Zone* zone) {
454 Property* prop = target()->AsProperty(); 458 Property* prop = target()->AsProperty();
455 ASSERT(prop != NULL); 459 ASSERT(prop != NULL);
456 TypeFeedbackId id = AssignmentFeedbackId(); 460 TypeFeedbackId id = AssignmentFeedbackId();
457 is_uninitialized_ = oracle->StoreIsUninitialized(id); 461 is_uninitialized_ = oracle->StoreIsUninitialized(id);
458 if (is_uninitialized_) return; 462 if (is_uninitialized_) return;
463
464 is_pre_monomorphic_ = oracle->StoreIsPreMonomorphic(id);
459 is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id); 465 is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id);
466 ASSERT((is_pre_monomorphic_ && !is_monomorphic_) ||
467 (!is_pre_monomorphic_ && is_monomorphic_));
460 receiver_types_.Clear(); 468 receiver_types_.Clear();
461 if (prop->key()->IsPropertyName()) { 469 if (prop->key()->IsPropertyName()) {
462 Literal* lit_key = prop->key()->AsLiteral(); 470 Literal* lit_key = prop->key()->AsLiteral();
463 ASSERT(lit_key != NULL && lit_key->value()->IsString()); 471 ASSERT(lit_key != NULL && lit_key->value()->IsString());
464 Handle<String> name = Handle<String>::cast(lit_key->value()); 472 Handle<String> name = Handle<String>::cast(lit_key->value());
465 oracle->StoreReceiverTypes(this, name, &receiver_types_); 473 oracle->StoreReceiverTypes(this, name, &receiver_types_);
466 } else if (is_monomorphic_) { 474 } else if (is_monomorphic_) {
467 // Record receiver type for monomorphic keyed stores. 475 // Record receiver type for monomorphic keyed stores.
468 receiver_types_.Add(oracle->StoreMonomorphicReceiverType(id), zone); 476 receiver_types_.Add(oracle->StoreMonomorphicReceiverType(id), zone);
469 store_mode_ = oracle->GetStoreMode(id); 477 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()); 1165 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value());
1158 str = arr; 1166 str = arr;
1159 } else { 1167 } else {
1160 str = DoubleToCString(value_->Number(), buffer); 1168 str = DoubleToCString(value_->Number(), buffer);
1161 } 1169 }
1162 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); 1170 return isolate_->factory()->NewStringFromAscii(CStrVector(str));
1163 } 1171 }
1164 1172
1165 1173
1166 } } // namespace v8::internal 1174 } } // 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