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

Side by Side Diff: src/hydrogen-instructions.h

Issue 21560002: Store transition on HStoreNamedField as HConstant. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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/hydrogen.cc ('k') | src/hydrogen-instructions.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 6354 matching lines...) Expand 10 before | Expand all | Expand 10 after
6365 // tagged[tagged] 6365 // tagged[tagged]
6366 return Representation::Tagged(); 6366 return Representation::Tagged();
6367 } 6367 }
6368 6368
6369 virtual HValue* Canonicalize(); 6369 virtual HValue* Canonicalize();
6370 6370
6371 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) 6371 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric)
6372 }; 6372 };
6373 6373
6374 6374
6375 class HStoreNamedField: public HTemplateInstruction<2> { 6375 class HStoreNamedField: public HTemplateInstruction<3> {
6376 public: 6376 public:
6377 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, 6377 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*,
6378 HObjectAccess, HValue*); 6378 HObjectAccess, HValue*);
6379 6379
6380 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) 6380 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField)
6381 6381
6382 virtual bool HasEscapingOperandAt(int index) { return index == 1; } 6382 virtual bool HasEscapingOperandAt(int index) { return index == 1; }
6383 virtual Representation RequiredInputRepresentation(int index) { 6383 virtual Representation RequiredInputRepresentation(int index) {
6384 if (index == 0 && access().IsExternalMemory()) { 6384 if (index == 0 && access().IsExternalMemory()) {
6385 // object must be external in case of external memory access 6385 // object must be external in case of external memory access
(...skipping 11 matching lines...) Expand all
6397 ASSERT(side_effect == kChangesNewSpacePromotion); 6397 ASSERT(side_effect == kChangesNewSpacePromotion);
6398 new_space_dominator_ = dominator; 6398 new_space_dominator_ = dominator;
6399 } 6399 }
6400 virtual void PrintDataTo(StringStream* stream); 6400 virtual void PrintDataTo(StringStream* stream);
6401 6401
6402 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } 6402 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; }
6403 bool IsSkipWriteBarrier() const { 6403 bool IsSkipWriteBarrier() const {
6404 return write_barrier_mode_ == SKIP_WRITE_BARRIER; 6404 return write_barrier_mode_ == SKIP_WRITE_BARRIER;
6405 } 6405 }
6406 6406
6407 HValue* object() { return OperandAt(0); } 6407 HValue* object() const { return OperandAt(0); }
6408 HValue* value() { return OperandAt(1); } 6408 HValue* value() const { return OperandAt(1); }
6409 HValue* transition() const { return OperandAt(2); }
6409 6410
6410 HObjectAccess access() const { return access_; } 6411 HObjectAccess access() const { return access_; }
6411 Handle<Map> transition() const { return transition_; } 6412 HValue* new_space_dominator() const { return new_space_dominator_; }
6412 UniqueValueId transition_unique_id() const { return transition_unique_id_; } 6413
6413 void SetTransition(Handle<Map> map, CompilationInfo* info) { 6414 bool has_transition() const {
6414 ASSERT(transition_.is_null()); // Only set once. 6415 return transition() != object();
6416 }
6417
6418 Handle<Map> transition_map() const {
6419 if (has_transition()) {
6420 return Handle<Map>::cast(HConstant::cast(transition())->handle());
6421 } else {
6422 return Handle<Map>();
6423 }
6424 }
6425
6426 void SetTransition(HConstant* map_constant, CompilationInfo* info) {
6427 ASSERT(!has_transition()); // Only set once.
6428 Handle<Map> map = Handle<Map>::cast(map_constant->handle());
6415 if (map->CanBeDeprecated()) { 6429 if (map->CanBeDeprecated()) {
6416 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); 6430 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info);
6417 } 6431 }
6418 transition_ = map; 6432 SetOperandAt(2, map_constant);
6419 } 6433 }
6420 HValue* new_space_dominator() const { return new_space_dominator_; }
6421 6434
6422 bool NeedsWriteBarrier() { 6435 bool NeedsWriteBarrier() {
6423 ASSERT(!(FLAG_track_double_fields && field_representation().IsDouble()) || 6436 ASSERT(!(FLAG_track_double_fields && field_representation().IsDouble()) ||
6424 transition_.is_null()); 6437 !has_transition());
6425 if (IsSkipWriteBarrier()) return false; 6438 if (IsSkipWriteBarrier()) return false;
6426 if (field_representation().IsDouble()) return false; 6439 if (field_representation().IsDouble()) return false;
6427 if (field_representation().IsSmi()) return false; 6440 if (field_representation().IsSmi()) return false;
6428 if (field_representation().IsInteger32()) return false; 6441 if (field_representation().IsInteger32()) return false;
6429 if (field_representation().IsExternal()) return false; 6442 if (field_representation().IsExternal()) return false;
6430 return StoringValueNeedsWriteBarrier(value()) && 6443 return StoringValueNeedsWriteBarrier(value()) &&
6431 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); 6444 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator());
6432 } 6445 }
6433 6446
6434 bool NeedsWriteBarrierForMap() { 6447 bool NeedsWriteBarrierForMap() {
6435 if (IsSkipWriteBarrier()) return false; 6448 if (IsSkipWriteBarrier()) return false;
6436 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); 6449 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator());
6437 } 6450 }
6438 6451
6439 virtual void FinalizeUniqueValueId() {
6440 transition_unique_id_ = UniqueValueId(transition_);
6441 }
6442
6443 Representation field_representation() const { 6452 Representation field_representation() const {
6444 return access_.representation(); 6453 return access_.representation();
6445 } 6454 }
6446 6455
6447 private: 6456 private:
6448 HStoreNamedField(HValue* obj, 6457 HStoreNamedField(HValue* obj,
6449 HObjectAccess access, 6458 HObjectAccess access,
6450 HValue* val) 6459 HValue* val)
6451 : access_(access), 6460 : access_(access),
6452 transition_(),
6453 transition_unique_id_(),
6454 new_space_dominator_(NULL), 6461 new_space_dominator_(NULL),
6455 write_barrier_mode_(UPDATE_WRITE_BARRIER) { 6462 write_barrier_mode_(UPDATE_WRITE_BARRIER) {
6456 SetOperandAt(0, obj); 6463 SetOperandAt(0, obj);
6457 SetOperandAt(1, val); 6464 SetOperandAt(1, val);
6465 SetOperandAt(2, obj);
6458 access.SetGVNFlags(this, true); 6466 access.SetGVNFlags(this, true);
6459 } 6467 }
6460 6468
6461 HObjectAccess access_; 6469 HObjectAccess access_;
6462 Handle<Map> transition_;
6463 UniqueValueId transition_unique_id_;
6464 HValue* new_space_dominator_; 6470 HValue* new_space_dominator_;
6465 WriteBarrierMode write_barrier_mode_; 6471 WriteBarrierMode write_barrier_mode_;
6466 }; 6472 };
6467 6473
6468 6474
6469 class HStoreNamedGeneric: public HTemplateInstruction<3> { 6475 class HStoreNamedGeneric: public HTemplateInstruction<3> {
6470 public: 6476 public:
6471 HStoreNamedGeneric(HValue* context, 6477 HStoreNamedGeneric(HValue* context,
6472 HValue* object, 6478 HValue* object,
6473 Handle<String> name, 6479 Handle<String> name,
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
7249 virtual bool IsDeletable() const { return true; } 7255 virtual bool IsDeletable() const { return true; }
7250 }; 7256 };
7251 7257
7252 7258
7253 #undef DECLARE_INSTRUCTION 7259 #undef DECLARE_INSTRUCTION
7254 #undef DECLARE_CONCRETE_INSTRUCTION 7260 #undef DECLARE_CONCRETE_INSTRUCTION
7255 7261
7256 } } // namespace v8::internal 7262 } } // namespace v8::internal
7257 7263
7258 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7264 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698