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

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

Issue 12300018: Made Isolate a mandatory parameter for everything Handle-related. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed CreateCode calls. Be nicer to MIPS. Created 7 years, 9 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 #define DECLARE_CONCRETE_INSTRUCTION(type) \ 226 #define DECLARE_CONCRETE_INSTRUCTION(type) \
227 virtual LInstruction* CompileToLithium(LChunkBuilder* builder); \ 227 virtual LInstruction* CompileToLithium(LChunkBuilder* builder); \
228 static H##type* cast(HValue* value) { \ 228 static H##type* cast(HValue* value) { \
229 ASSERT(value->Is##type()); \ 229 ASSERT(value->Is##type()); \
230 return reinterpret_cast<H##type*>(value); \ 230 return reinterpret_cast<H##type*>(value); \
231 } \ 231 } \
232 virtual Opcode opcode() const { return HValue::k##type; } 232 virtual Opcode opcode() const { return HValue::k##type; }
233 233
234 234
235 #ifdef DEBUG 235 #ifdef DEBUG
236 #define ASSERT_ALLOCATION_DISABLED do { \ 236 #define ASSERT_ALLOCATION_DISABLED \
237 OptimizingCompilerThread* thread = \ 237 ASSERT(isolate()->optimizing_compiler_thread()->IsOptimizerThread() || \
238 ISOLATE->optimizing_compiler_thread(); \ 238 !isolate()->heap()->IsAllocationAllowed())
239 ASSERT(thread->IsOptimizerThread() || !HEAP->IsAllocationAllowed()); \
240 } while (0)
241 #else 239 #else
242 #define ASSERT_ALLOCATION_DISABLED do {} while (0) 240 #define ASSERT_ALLOCATION_DISABLED do {} while (0)
243 #endif 241 #endif
244 242
245 class Range: public ZoneObject { 243 class Range: public ZoneObject {
246 public: 244 public:
247 Range() 245 Range()
248 : lower_(kMinInt), 246 : lower_(kMinInt),
249 upper_(kMaxInt), 247 upper_(kMaxInt),
250 next_(NULL), 248 next_(NULL),
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 443
446 bool IsUninitialized() { 444 bool IsUninitialized() {
447 return type_ == kUninitialized; 445 return type_ == kUninitialized;
448 } 446 }
449 447
450 bool IsHeapObject() { 448 bool IsHeapObject() {
451 ASSERT(type_ != kUninitialized); 449 ASSERT(type_ != kUninitialized);
452 return IsHeapNumber() || IsString() || IsNonPrimitive(); 450 return IsHeapNumber() || IsString() || IsNonPrimitive();
453 } 451 }
454 452
455 static HType TypeFromValue(Handle<Object> value); 453 static HType TypeFromValue(Isolate* isolate, Handle<Object> value);
456 454
457 const char* ToString(); 455 const char* ToString();
458 456
459 private: 457 private:
460 enum Type { 458 enum Type {
461 kTagged = 0x1, // 0000 0000 0000 0001 459 kTagged = 0x1, // 0000 0000 0000 0001
462 kTaggedPrimitive = 0x5, // 0000 0000 0000 0101 460 kTaggedPrimitive = 0x5, // 0000 0000 0000 0101
463 kTaggedNumber = 0xd, // 0000 0000 0000 1101 461 kTaggedNumber = 0xd, // 0000 0000 0000 1101
464 kSmi = 0x1d, // 0000 0000 0001 1101 462 kSmi = 0x1d, // 0000 0000 0001 1101
465 kHeapNumber = 0x2d, // 0000 0000 0010 1101 463 kHeapNumber = 0x2d, // 0000 0000 0010 1101
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 type_(HType::Tagged()), 755 type_(HType::Tagged()),
758 use_list_(NULL), 756 use_list_(NULL),
759 range_(NULL), 757 range_(NULL),
760 flags_(0) {} 758 flags_(0) {}
761 virtual ~HValue() {} 759 virtual ~HValue() {}
762 760
763 HBasicBlock* block() const { return block_; } 761 HBasicBlock* block() const { return block_; }
764 void SetBlock(HBasicBlock* block); 762 void SetBlock(HBasicBlock* block);
765 int LoopWeight() const; 763 int LoopWeight() const;
766 764
765 // Note: Never call this method for an unlinked value.
766 Isolate* isolate() const;
767
767 int id() const { return id_; } 768 int id() const { return id_; }
768 void set_id(int id) { id_ = id; } 769 void set_id(int id) { id_ = id; }
769 770
770 HUseIterator uses() const { return HUseIterator(use_list_); } 771 HUseIterator uses() const { return HUseIterator(use_list_); }
771 772
772 virtual bool EmitAtUses() { return false; } 773 virtual bool EmitAtUses() { return false; }
773 Representation representation() const { return representation_; } 774 Representation representation() const { return representation_; }
774 void ChangeRepresentation(Representation r) { 775 void ChangeRepresentation(Representation r) {
775 ASSERT(CheckFlag(kFlexibleRepresentation)); 776 ASSERT(CheckFlag(kFlexibleRepresentation));
776 RepresentationChanged(r); 777 RepresentationChanged(r);
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after
2759 2760
2760 virtual Representation RequiredInputRepresentation(int index) { 2761 virtual Representation RequiredInputRepresentation(int index) {
2761 return Representation::None(); 2762 return Representation::None();
2762 } 2763 }
2763 2764
2764 virtual void PrintDataTo(StringStream* stream); 2765 virtual void PrintDataTo(StringStream* stream);
2765 2766
2766 virtual intptr_t Hashcode() { 2767 virtual intptr_t Hashcode() {
2767 ASSERT_ALLOCATION_DISABLED; 2768 ASSERT_ALLOCATION_DISABLED;
2768 // Dereferencing to use the object's raw address for hashing is safe. 2769 // Dereferencing to use the object's raw address for hashing is safe.
2769 AllowHandleDereference allow_handle_deref; 2770 AllowHandleDereference allow_handle_deref(isolate());
2770 intptr_t hash = 0; 2771 intptr_t hash = 0;
2771 for (int i = 0; i < prototypes_.length(); i++) { 2772 for (int i = 0; i < prototypes_.length(); i++) {
2772 hash = 17 * hash + reinterpret_cast<intptr_t>(*prototypes_[i]); 2773 hash = 17 * hash + reinterpret_cast<intptr_t>(*prototypes_[i]);
2773 hash = 17 * hash + reinterpret_cast<intptr_t>(*maps_[i]); 2774 hash = 17 * hash + reinterpret_cast<intptr_t>(*maps_[i]);
2774 } 2775 }
2775 return hash; 2776 return hash;
2776 } 2777 }
2777 2778
2778 bool CanOmitPrototypeChecks() { 2779 bool CanOmitPrototypeChecks() {
2779 for (int i = 0; i < maps()->length(); i++) { 2780 for (int i = 0; i < maps()->length(); i++) {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
3063 } 3064 }
3064 if (has_double_value_) { 3065 if (has_double_value_) {
3065 if (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || 3066 if (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) ||
3066 isnan(double_value_)) { 3067 isnan(double_value_)) {
3067 return true; 3068 return true;
3068 } 3069 }
3069 return false; 3070 return false;
3070 } 3071 }
3071 3072
3072 ASSERT(!handle_.is_null()); 3073 ASSERT(!handle_.is_null());
3073 Heap* heap = HEAP; 3074 Heap* heap = isolate()->heap();
3074 // We should have handled minus_zero_value and nan_value in the 3075 // We should have handled minus_zero_value and nan_value in the
3075 // has_double_value_ clause above. 3076 // has_double_value_ clause above.
3076 // Dereferencing is safe to compare against singletons. 3077 // Dereferencing is safe to compare against singletons.
3077 AllowHandleDereference allow_handle_deref; 3078 AllowHandleDereference allow_handle_deref(isolate());
3078 ASSERT(*handle_ != heap->minus_zero_value()); 3079 ASSERT(*handle_ != heap->minus_zero_value());
3079 ASSERT(*handle_ != heap->nan_value()); 3080 ASSERT(*handle_ != heap->nan_value());
3080 return *handle_ == heap->undefined_value() || 3081 return *handle_ == heap->undefined_value() ||
3081 *handle_ == heap->null_value() || 3082 *handle_ == heap->null_value() ||
3082 *handle_ == heap->true_value() || 3083 *handle_ == heap->true_value() ||
3083 *handle_ == heap->false_value() || 3084 *handle_ == heap->false_value() ||
3084 *handle_ == heap->the_hole_value() || 3085 *handle_ == heap->the_hole_value() ||
3085 *handle_ == heap->empty_string(); 3086 *handle_ == heap->empty_string();
3086 } 3087 }
3087 3088
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 ASSERT_ALLOCATION_DISABLED; 3141 ASSERT_ALLOCATION_DISABLED;
3141 intptr_t hash; 3142 intptr_t hash;
3142 3143
3143 if (has_int32_value_) { 3144 if (has_int32_value_) {
3144 hash = static_cast<intptr_t>(int32_value_); 3145 hash = static_cast<intptr_t>(int32_value_);
3145 } else if (has_double_value_) { 3146 } else if (has_double_value_) {
3146 hash = static_cast<intptr_t>(BitCast<int64_t>(double_value_)); 3147 hash = static_cast<intptr_t>(BitCast<int64_t>(double_value_));
3147 } else { 3148 } else {
3148 ASSERT(!handle_.is_null()); 3149 ASSERT(!handle_.is_null());
3149 // Dereferencing to use the object's raw address for hashing is safe. 3150 // Dereferencing to use the object's raw address for hashing is safe.
3150 AllowHandleDereference allow_handle_deref; 3151 AllowHandleDereference allow_handle_deref(isolate());
3151 hash = reinterpret_cast<intptr_t>(*handle_); 3152 hash = reinterpret_cast<intptr_t>(*handle_);
3152 } 3153 }
3153 3154
3154 return hash; 3155 return hash;
3155 } 3156 }
3156 3157
3157 #ifdef DEBUG 3158 #ifdef DEBUG
3158 virtual void Verify() { } 3159 virtual void Verify() { }
3159 #endif 3160 #endif
3160 3161
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
4471 } 4472 }
4472 4473
4473 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 4474 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
4474 bool RequiresHoleCheck() const; 4475 bool RequiresHoleCheck() const;
4475 4476
4476 virtual void PrintDataTo(StringStream* stream); 4477 virtual void PrintDataTo(StringStream* stream);
4477 4478
4478 virtual intptr_t Hashcode() { 4479 virtual intptr_t Hashcode() {
4479 ASSERT_ALLOCATION_DISABLED; 4480 ASSERT_ALLOCATION_DISABLED;
4480 // Dereferencing to use the object's raw address for hashing is safe. 4481 // Dereferencing to use the object's raw address for hashing is safe.
4481 AllowHandleDereference allow_handle_deref; 4482 AllowHandleDereference allow_handle_deref(isolate());
4482 return reinterpret_cast<intptr_t>(*cell_); 4483 return reinterpret_cast<intptr_t>(*cell_);
4483 } 4484 }
4484 4485
4485 virtual Representation RequiredInputRepresentation(int index) { 4486 virtual Representation RequiredInputRepresentation(int index) {
4486 return Representation::None(); 4487 return Representation::None();
4487 } 4488 }
4488 4489
4489 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) 4490 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell)
4490 4491
4491 protected: 4492 protected:
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after
6118 virtual bool IsDeletable() const { return true; } 6119 virtual bool IsDeletable() const { return true; }
6119 }; 6120 };
6120 6121
6121 6122
6122 #undef DECLARE_INSTRUCTION 6123 #undef DECLARE_INSTRUCTION
6123 #undef DECLARE_CONCRETE_INSTRUCTION 6124 #undef DECLARE_CONCRETE_INSTRUCTION
6124 6125
6125 } } // namespace v8::internal 6126 } } // namespace v8::internal
6126 6127
6127 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6128 #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