| OLD | NEW |
| 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 Loading... |
| 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), | |
| 143 store_mode_(STANDARD_STORE) { } | 142 store_mode_(STANDARD_STORE) { } |
| 144 | 143 |
| 145 | 144 |
| 146 Token::Value Assignment::binary_op() const { | 145 Token::Value Assignment::binary_op() const { |
| 147 switch (op_) { | 146 switch (op_) { |
| 148 case Token::ASSIGN_BIT_OR: return Token::BIT_OR; | 147 case Token::ASSIGN_BIT_OR: return Token::BIT_OR; |
| 149 case Token::ASSIGN_BIT_XOR: return Token::BIT_XOR; | 148 case Token::ASSIGN_BIT_XOR: return Token::BIT_XOR; |
| 150 case Token::ASSIGN_BIT_AND: return Token::BIT_AND; | 149 case Token::ASSIGN_BIT_AND: return Token::BIT_AND; |
| 151 case Token::ASSIGN_SHL: return Token::SHL; | 150 case Token::ASSIGN_SHL: return Token::SHL; |
| 152 case Token::ASSIGN_SAR: return Token::SAR; | 151 case Token::ASSIGN_SAR: return Token::SAR; |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 to_boolean_types_ = oracle->ToBooleanTypes(test_id()); | 419 to_boolean_types_ = oracle->ToBooleanTypes(test_id()); |
| 421 } | 420 } |
| 422 | 421 |
| 423 | 422 |
| 424 void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle, | 423 void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle, |
| 425 Zone* zone) { | 424 Zone* zone) { |
| 426 // Record type feedback from the oracle in the AST. | 425 // Record type feedback from the oracle in the AST. |
| 427 is_uninitialized_ = oracle->LoadIsUninitialized(this); | 426 is_uninitialized_ = oracle->LoadIsUninitialized(this); |
| 428 if (is_uninitialized_) return; | 427 if (is_uninitialized_) return; |
| 429 | 428 |
| 430 is_pre_monomorphic_ = oracle->LoadIsPreMonomorphic(this); | |
| 431 is_monomorphic_ = oracle->LoadIsMonomorphicNormal(this); | 429 is_monomorphic_ = oracle->LoadIsMonomorphicNormal(this); |
| 432 ASSERT((is_pre_monomorphic_ && !is_monomorphic_) || | |
| 433 (!is_pre_monomorphic_ && is_monomorphic_)); | |
| 434 receiver_types_.Clear(); | 430 receiver_types_.Clear(); |
| 435 if (key()->IsPropertyName()) { | 431 if (key()->IsPropertyName()) { |
| 436 FunctionPrototypeStub proto_stub(Code::LOAD_IC); | 432 FunctionPrototypeStub proto_stub(Code::LOAD_IC); |
| 437 if (oracle->LoadIsStub(this, &proto_stub)) { | 433 if (oracle->LoadIsStub(this, &proto_stub)) { |
| 438 is_function_prototype_ = true; | 434 is_function_prototype_ = true; |
| 439 } else { | 435 } else { |
| 440 Literal* lit_key = key()->AsLiteral(); | 436 Literal* lit_key = key()->AsLiteral(); |
| 441 ASSERT(lit_key != NULL && lit_key->value()->IsString()); | 437 ASSERT(lit_key != NULL && lit_key->value()->IsString()); |
| 442 Handle<String> name = Handle<String>::cast(lit_key->value()); | 438 Handle<String> name = Handle<String>::cast(lit_key->value()); |
| 443 oracle->LoadReceiverTypes(this, name, &receiver_types_); | 439 oracle->LoadReceiverTypes(this, name, &receiver_types_); |
| 444 } | 440 } |
| 445 } else if (oracle->LoadIsBuiltin(this, Builtins::kKeyedLoadIC_String)) { | 441 } else if (oracle->LoadIsBuiltin(this, Builtins::kKeyedLoadIC_String)) { |
| 446 is_string_access_ = true; | 442 is_string_access_ = true; |
| 447 } else if (is_monomorphic_) { | 443 } else if (is_monomorphic_) { |
| 448 receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this), zone); | 444 receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this), zone); |
| 449 } else if (oracle->LoadIsPolymorphic(this)) { | 445 } else if (oracle->LoadIsPolymorphic(this)) { |
| 450 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone); | 446 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone); |
| 451 oracle->CollectKeyedReceiverTypes(PropertyFeedbackId(), &receiver_types_); | 447 oracle->CollectKeyedReceiverTypes(PropertyFeedbackId(), &receiver_types_); |
| 452 } | 448 } |
| 453 } | 449 } |
| 454 | 450 |
| 455 | 451 |
| 456 void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle, | 452 void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle, |
| 457 Zone* zone) { | 453 Zone* zone) { |
| 458 Property* prop = target()->AsProperty(); | 454 Property* prop = target()->AsProperty(); |
| 459 ASSERT(prop != NULL); | 455 ASSERT(prop != NULL); |
| 460 TypeFeedbackId id = AssignmentFeedbackId(); | 456 TypeFeedbackId id = AssignmentFeedbackId(); |
| 461 is_uninitialized_ = oracle->StoreIsUninitialized(id); | 457 is_uninitialized_ = oracle->StoreIsUninitialized(id); |
| 462 if (is_uninitialized_) return; | 458 if (is_uninitialized_) return; |
| 463 | |
| 464 is_pre_monomorphic_ = oracle->StoreIsPreMonomorphic(id); | |
| 465 is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id); | 459 is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id); |
| 466 ASSERT((is_pre_monomorphic_ && !is_monomorphic_) || | |
| 467 (!is_pre_monomorphic_ && is_monomorphic_)); | |
| 468 receiver_types_.Clear(); | 460 receiver_types_.Clear(); |
| 469 if (prop->key()->IsPropertyName()) { | 461 if (prop->key()->IsPropertyName()) { |
| 470 Literal* lit_key = prop->key()->AsLiteral(); | 462 Literal* lit_key = prop->key()->AsLiteral(); |
| 471 ASSERT(lit_key != NULL && lit_key->value()->IsString()); | 463 ASSERT(lit_key != NULL && lit_key->value()->IsString()); |
| 472 Handle<String> name = Handle<String>::cast(lit_key->value()); | 464 Handle<String> name = Handle<String>::cast(lit_key->value()); |
| 473 oracle->StoreReceiverTypes(this, name, &receiver_types_); | 465 oracle->StoreReceiverTypes(this, name, &receiver_types_); |
| 474 } else if (is_monomorphic_) { | 466 } else if (is_monomorphic_) { |
| 475 // Record receiver type for monomorphic keyed stores. | 467 // Record receiver type for monomorphic keyed stores. |
| 476 receiver_types_.Add(oracle->StoreMonomorphicReceiverType(id), zone); | 468 receiver_types_.Add(oracle->StoreMonomorphicReceiverType(id), zone); |
| 477 store_mode_ = oracle->GetStoreMode(id); | 469 store_mode_ = oracle->GetStoreMode(id); |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); | 1157 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); |
| 1166 str = arr; | 1158 str = arr; |
| 1167 } else { | 1159 } else { |
| 1168 str = DoubleToCString(value_->Number(), buffer); | 1160 str = DoubleToCString(value_->Number(), buffer); |
| 1169 } | 1161 } |
| 1170 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); | 1162 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); |
| 1171 } | 1163 } |
| 1172 | 1164 |
| 1173 | 1165 |
| 1174 } } // namespace v8::internal | 1166 } } // namespace v8::internal |
| OLD | NEW |