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

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

Issue 16925008: Generate StoreGlobal stubs with Hydrogen (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address feedback Created 7 years, 5 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
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 3273 matching lines...) Expand 10 before | Expand all | Expand 10 after
3284 HConstant(double value, 3284 HConstant(double value,
3285 Representation r = Representation::None(), 3285 Representation r = Representation::None(),
3286 bool is_not_in_new_space = true, 3286 bool is_not_in_new_space = true,
3287 Handle<Object> optional_handle = Handle<Object>::null()); 3287 Handle<Object> optional_handle = Handle<Object>::null());
3288 HConstant(Handle<Object> handle, 3288 HConstant(Handle<Object> handle,
3289 UniqueValueId unique_id, 3289 UniqueValueId unique_id,
3290 Representation r, 3290 Representation r,
3291 HType type, 3291 HType type,
3292 bool is_internalized_string, 3292 bool is_internalized_string,
3293 bool is_not_in_new_space, 3293 bool is_not_in_new_space,
3294 bool is_cell,
3294 bool boolean_value); 3295 bool boolean_value);
3295 3296
3296 Handle<Object> handle() { 3297 Handle<Object> handle() {
3297 if (handle_.is_null()) { 3298 if (handle_.is_null()) {
3298 Factory* factory = Isolate::Current()->factory(); 3299 Factory* factory = Isolate::Current()->factory();
3299 // Default arguments to is_not_in_new_space depend on this heap number 3300 // Default arguments to is_not_in_new_space depend on this heap number
3300 // to be tenured so that it's guaranteed not be be located in new space. 3301 // to be tenured so that it's guaranteed not be be located in new space.
3301 handle_ = factory->NewNumber(double_value_, TENURED); 3302 handle_ = factory->NewNumber(double_value_, TENURED);
3302 } 3303 }
3303 AllowDeferredHandleDereference smi_check; 3304 AllowDeferredHandleDereference smi_check;
(...skipping 28 matching lines...) Expand all
3332 ASSERT(unique_id_ != UniqueValueId(heap->minus_zero_value())); 3333 ASSERT(unique_id_ != UniqueValueId(heap->minus_zero_value()));
3333 ASSERT(unique_id_ != UniqueValueId(heap->nan_value())); 3334 ASSERT(unique_id_ != UniqueValueId(heap->nan_value()));
3334 return unique_id_ == UniqueValueId(heap->undefined_value()) || 3335 return unique_id_ == UniqueValueId(heap->undefined_value()) ||
3335 unique_id_ == UniqueValueId(heap->null_value()) || 3336 unique_id_ == UniqueValueId(heap->null_value()) ||
3336 unique_id_ == UniqueValueId(heap->true_value()) || 3337 unique_id_ == UniqueValueId(heap->true_value()) ||
3337 unique_id_ == UniqueValueId(heap->false_value()) || 3338 unique_id_ == UniqueValueId(heap->false_value()) ||
3338 unique_id_ == UniqueValueId(heap->the_hole_value()) || 3339 unique_id_ == UniqueValueId(heap->the_hole_value()) ||
3339 unique_id_ == UniqueValueId(heap->empty_string()); 3340 unique_id_ == UniqueValueId(heap->empty_string());
3340 } 3341 }
3341 3342
3343 bool IsCell() const {
3344 return is_cell_;
3345 }
3346
3342 virtual Representation RequiredInputRepresentation(int index) { 3347 virtual Representation RequiredInputRepresentation(int index) {
3343 return Representation::None(); 3348 return Representation::None();
3344 } 3349 }
3345 3350
3346 virtual Representation KnownOptimalRepresentation() { 3351 virtual Representation KnownOptimalRepresentation() {
3347 if (HasSmiValue()) return Representation::Smi(); 3352 if (HasSmiValue()) return Representation::Smi();
3348 if (HasInteger32Value()) return Representation::Integer32(); 3353 if (HasInteger32Value()) return Representation::Integer32();
3349 if (HasNumberValue()) return Representation::Double(); 3354 if (HasNumberValue()) return Representation::Double();
3350 return Representation::Tagged(); 3355 return Representation::Tagged();
3351 } 3356 }
3352 3357
3353 virtual bool EmitAtUses() { return !representation().IsDouble(); } 3358 virtual bool EmitAtUses();
3354 virtual void PrintDataTo(StringStream* stream); 3359 virtual void PrintDataTo(StringStream* stream);
3355 virtual HType CalculateInferredType(); 3360 virtual HType CalculateInferredType();
3356 bool IsInteger() { return handle()->IsSmi(); } 3361 bool IsInteger() { return handle()->IsSmi(); }
3357 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; 3362 HConstant* CopyToRepresentation(Representation r, Zone* zone) const;
3358 HConstant* CopyToTruncatedInt32(Zone* zone) const; 3363 HConstant* CopyToTruncatedInt32(Zone* zone) const;
3359 bool HasInteger32Value() const { return has_int32_value_; } 3364 bool HasInteger32Value() const { return has_int32_value_; }
3360 int32_t Integer32Value() const { 3365 int32_t Integer32Value() const {
3361 ASSERT(HasInteger32Value()); 3366 ASSERT(HasInteger32Value());
3362 return int32_value_; 3367 return int32_value_;
3363 } 3368 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
3458 // We store the HConstant in the most specific form safely possible. 3463 // We store the HConstant in the most specific form safely possible.
3459 // The two flags, has_int32_value_ and has_double_value_ tell us if 3464 // The two flags, has_int32_value_ and has_double_value_ tell us if
3460 // int32_value_ and double_value_ hold valid, safe representations 3465 // int32_value_ and double_value_ hold valid, safe representations
3461 // of the constant. has_int32_value_ implies has_double_value_ but 3466 // of the constant. has_int32_value_ implies has_double_value_ but
3462 // not the converse. 3467 // not the converse.
3463 bool has_smi_value_ : 1; 3468 bool has_smi_value_ : 1;
3464 bool has_int32_value_ : 1; 3469 bool has_int32_value_ : 1;
3465 bool has_double_value_ : 1; 3470 bool has_double_value_ : 1;
3466 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. 3471 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType.
3467 bool is_not_in_new_space_ : 1; 3472 bool is_not_in_new_space_ : 1;
3473 bool is_cell_ : 1;
3468 bool boolean_value_ : 1; 3474 bool boolean_value_ : 1;
3469 int32_t int32_value_; 3475 int32_t int32_value_;
3470 double double_value_; 3476 double double_value_;
3471 HType type_from_value_; 3477 HType type_from_value_;
3472 }; 3478 };
3473 3479
3474 3480
3475 class HBinaryOperation: public HTemplateInstruction<3> { 3481 class HBinaryOperation: public HTemplateInstruction<3> {
3476 public: 3482 public:
3477 HBinaryOperation(HValue* context, HValue* left, HValue* right) 3483 HBinaryOperation(HValue* context, HValue* left, HValue* right)
(...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after
5111 } 5117 }
5112 5118
5113 5119
5114 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, 5120 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object,
5115 HValue* new_space_dominator) { 5121 HValue* new_space_dominator) {
5116 if (object->IsInnerAllocatedObject()) { 5122 if (object->IsInnerAllocatedObject()) {
5117 return ReceiverObjectNeedsWriteBarrier( 5123 return ReceiverObjectNeedsWriteBarrier(
5118 HInnerAllocatedObject::cast(object)->base_object(), 5124 HInnerAllocatedObject::cast(object)->base_object(),
5119 new_space_dominator); 5125 new_space_dominator);
5120 } 5126 }
5127 if (object->IsConstant() && HConstant::cast(object)->IsCell()) {
5128 return false;
5129 }
5121 if (object != new_space_dominator) return true; 5130 if (object != new_space_dominator) return true;
5122 if (object->IsAllocateObject()) return false; 5131 if (object->IsAllocateObject()) return false;
5123 if (object->IsAllocate()) { 5132 if (object->IsAllocate()) {
5124 return !HAllocate::cast(object)->GuaranteedInNewSpace(); 5133 return !HAllocate::cast(object)->GuaranteedInNewSpace();
5125 } 5134 }
5126 return true; 5135 return true;
5127 } 5136 }
5128 5137
5129 5138
5130 class HStoreGlobalCell: public HUnaryOperation { 5139 class HStoreGlobalCell: public HUnaryOperation {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
5372 // Create an access to an in-object property in a JSArray. 5381 // Create an access to an in-object property in a JSArray.
5373 static HObjectAccess ForJSArrayOffset(int offset); 5382 static HObjectAccess ForJSArrayOffset(int offset);
5374 5383
5375 // Create an access to the backing store of an object. 5384 // Create an access to the backing store of an object.
5376 static HObjectAccess ForBackingStoreOffset(int offset); 5385 static HObjectAccess ForBackingStoreOffset(int offset);
5377 5386
5378 // Create an access to a resolved field (in-object or backing store). 5387 // Create an access to a resolved field (in-object or backing store).
5379 static HObjectAccess ForField(Handle<Map> map, 5388 static HObjectAccess ForField(Handle<Map> map,
5380 LookupResult *lookup, Handle<String> name = Handle<String>::null()); 5389 LookupResult *lookup, Handle<String> name = Handle<String>::null());
5381 5390
5391 // Create an access for the payload of a Cell or JSGlobalPropertyCell.
5392 static HObjectAccess ForCellPayload(Isolate* isolate);
5393
5382 void PrintTo(StringStream* stream); 5394 void PrintTo(StringStream* stream);
5383 5395
5384 inline bool Equals(HObjectAccess that) const { 5396 inline bool Equals(HObjectAccess that) const {
5385 return value_ == that.value_; // portion and offset must match 5397 return value_ == that.value_; // portion and offset must match
5386 } 5398 }
5387 5399
5388 protected: 5400 protected:
5389 void SetGVNFlags(HValue *instr, bool is_store); 5401 void SetGVNFlags(HValue *instr, bool is_store);
5390 5402
5391 private: 5403 private:
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
6682 virtual bool IsDeletable() const { return true; } 6694 virtual bool IsDeletable() const { return true; }
6683 }; 6695 };
6684 6696
6685 6697
6686 #undef DECLARE_INSTRUCTION 6698 #undef DECLARE_INSTRUCTION
6687 #undef DECLARE_CONCRETE_INSTRUCTION 6699 #undef DECLARE_CONCRETE_INSTRUCTION
6688 6700
6689 } } // namespace v8::internal 6701 } } // namespace v8::internal
6690 6702
6691 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6703 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698