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

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: Use pointer -> handle trampoline 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 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after
5110 } 5116 }
5111 5117
5112 5118
5113 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, 5119 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object,
5114 HValue* new_space_dominator) { 5120 HValue* new_space_dominator) {
5115 if (object->IsInnerAllocatedObject()) { 5121 if (object->IsInnerAllocatedObject()) {
5116 return ReceiverObjectNeedsWriteBarrier( 5122 return ReceiverObjectNeedsWriteBarrier(
5117 HInnerAllocatedObject::cast(object)->base_object(), 5123 HInnerAllocatedObject::cast(object)->base_object(),
5118 new_space_dominator); 5124 new_space_dominator);
5119 } 5125 }
5126 if (object->IsConstant() && HConstant::cast(object)->IsCell()) {
5127 return false;
5128 }
5120 if (object != new_space_dominator) return true; 5129 if (object != new_space_dominator) return true;
5121 if (object->IsAllocateObject()) return false; 5130 if (object->IsAllocateObject()) return false;
5122 if (object->IsAllocate()) { 5131 if (object->IsAllocate()) {
5123 return !HAllocate::cast(object)->GuaranteedInNewSpace(); 5132 return !HAllocate::cast(object)->GuaranteedInNewSpace();
5124 } 5133 }
5125 return true; 5134 return true;
5126 } 5135 }
5127 5136
5128 5137
5129 class HStoreGlobalCell: public HUnaryOperation { 5138 class HStoreGlobalCell: public HUnaryOperation {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
5371 // Create an access to an in-object property in a JSArray. 5380 // Create an access to an in-object property in a JSArray.
5372 static HObjectAccess ForJSArrayOffset(int offset); 5381 static HObjectAccess ForJSArrayOffset(int offset);
5373 5382
5374 // Create an access to the backing store of an object. 5383 // Create an access to the backing store of an object.
5375 static HObjectAccess ForBackingStoreOffset(int offset); 5384 static HObjectAccess ForBackingStoreOffset(int offset);
5376 5385
5377 // Create an access to a resolved field (in-object or backing store). 5386 // Create an access to a resolved field (in-object or backing store).
5378 static HObjectAccess ForField(Handle<Map> map, 5387 static HObjectAccess ForField(Handle<Map> map,
5379 LookupResult *lookup, Handle<String> name = Handle<String>::null()); 5388 LookupResult *lookup, Handle<String> name = Handle<String>::null());
5380 5389
5390 // Create an access for the payload of a Cell or JSGlobalPropertyCell.
5391 static HObjectAccess ForCellPayload(Isolate* isolate);
5392
5381 void PrintTo(StringStream* stream); 5393 void PrintTo(StringStream* stream);
5382 5394
5383 inline bool Equals(HObjectAccess that) const { 5395 inline bool Equals(HObjectAccess that) const {
5384 return value_ == that.value_; // portion and offset must match 5396 return value_ == that.value_; // portion and offset must match
5385 } 5397 }
5386 5398
5387 protected: 5399 protected:
5388 void SetGVNFlags(HValue *instr, bool is_store); 5400 void SetGVNFlags(HValue *instr, bool is_store);
5389 5401
5390 private: 5402 private:
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
6681 virtual bool IsDeletable() const { return true; } 6693 virtual bool IsDeletable() const { return true; }
6682 }; 6694 };
6683 6695
6684 6696
6685 #undef DECLARE_INSTRUCTION 6697 #undef DECLARE_INSTRUCTION
6686 #undef DECLARE_CONCRETE_INSTRUCTION 6698 #undef DECLARE_CONCRETE_INSTRUCTION
6687 6699
6688 } } // namespace v8::internal 6700 } } // namespace v8::internal
6689 6701
6690 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6702 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698