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

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

Issue 24027004: thread isolate for HConstant::handle (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 3267 matching lines...) Expand 10 before | Expand all | Expand 10 after
3278 HValue* context, 3278 HValue* context,
3279 int32_t value, 3279 int32_t value,
3280 Representation representation, 3280 Representation representation,
3281 HInstruction* instruction) { 3281 HInstruction* instruction) {
3282 HConstant* new_constant = 3282 HConstant* new_constant =
3283 HConstant::New(zone, context, value, representation); 3283 HConstant::New(zone, context, value, representation);
3284 new_constant->InsertBefore(instruction); 3284 new_constant->InsertBefore(instruction);
3285 return new_constant; 3285 return new_constant;
3286 } 3286 }
3287 3287
3288 Handle<Object> handle() { 3288 Handle<Object> handle(Isolate* isolate) {
3289 if (handle_.is_null()) { 3289 if (handle_.is_null()) {
3290 Factory* factory = Isolate::Current()->factory(); 3290 Factory* factory = isolate->factory();
3291 // Default arguments to is_not_in_new_space depend on this heap number 3291 // Default arguments to is_not_in_new_space depend on this heap number
3292 // to be tenured so that it's guaranteed not be be located in new space. 3292 // to be tenured so that it's guaranteed not be be located in new space.
3293 handle_ = factory->NewNumber(double_value_, TENURED); 3293 handle_ = factory->NewNumber(double_value_, TENURED);
3294 } 3294 }
3295 AllowDeferredHandleDereference smi_check; 3295 AllowDeferredHandleDereference smi_check;
3296 ASSERT(has_int32_value_ || !handle_->IsSmi()); 3296 ASSERT(has_int32_value_ || !handle_->IsSmi());
3297 return handle_; 3297 return handle_;
3298 } 3298 }
3299 3299
3300 bool HasMap(Handle<Map> map) { 3300 bool HasMap(Handle<Map> map) {
3301 Handle<Object> constant_object = handle(); 3301 Handle<Object> constant_object = handle(map->GetIsolate());
3302 return constant_object->IsHeapObject() && 3302 return constant_object->IsHeapObject() &&
3303 Handle<HeapObject>::cast(constant_object)->map() == *map; 3303 Handle<HeapObject>::cast(constant_object)->map() == *map;
3304 } 3304 }
3305 3305
3306 bool IsSpecialDouble() const { 3306 bool IsSpecialDouble() const {
3307 return has_double_value_ && 3307 return has_double_value_ &&
3308 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || 3308 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) ||
3309 FixedDoubleArray::is_the_hole_nan(double_value_) || 3309 FixedDoubleArray::is_the_hole_nan(double_value_) ||
3310 std::isnan(double_value_)); 3310 std::isnan(double_value_));
3311 } 3311 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3351 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { 3351 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE {
3352 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi(); 3352 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi();
3353 if (HasInteger32Value()) return Representation::Integer32(); 3353 if (HasInteger32Value()) return Representation::Integer32();
3354 if (HasNumberValue()) return Representation::Double(); 3354 if (HasNumberValue()) return Representation::Double();
3355 if (HasExternalReferenceValue()) return Representation::External(); 3355 if (HasExternalReferenceValue()) return Representation::External();
3356 return Representation::Tagged(); 3356 return Representation::Tagged();
3357 } 3357 }
3358 3358
3359 virtual bool EmitAtUses() V8_OVERRIDE; 3359 virtual bool EmitAtUses() V8_OVERRIDE;
3360 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 3360 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
3361 bool IsInteger() { return handle()->IsSmi(); }
3362 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; 3361 HConstant* CopyToRepresentation(Representation r, Zone* zone) const;
3363 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone); 3362 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone);
3364 Maybe<HConstant*> CopyToTruncatedNumber(Zone* zone); 3363 Maybe<HConstant*> CopyToTruncatedNumber(Zone* zone);
3365 bool HasInteger32Value() const { return has_int32_value_; } 3364 bool HasInteger32Value() const { return has_int32_value_; }
3366 int32_t Integer32Value() const { 3365 int32_t Integer32Value() const {
3367 ASSERT(HasInteger32Value()); 3366 ASSERT(HasInteger32Value());
3368 return int32_value_; 3367 return int32_value_;
3369 } 3368 }
3370 bool HasSmiValue() const { return has_smi_value_; } 3369 bool HasSmiValue() const { return has_smi_value_; }
3371 bool HasDoubleValue() const { return has_double_value_; } 3370 bool HasDoubleValue() const { return has_double_value_; }
(...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after
6098 HValue* object() const { return OperandAt(0); } 6097 HValue* object() const { return OperandAt(0); }
6099 HValue* value() const { return OperandAt(1); } 6098 HValue* value() const { return OperandAt(1); }
6100 HValue* transition() const { return OperandAt(2); } 6099 HValue* transition() const { return OperandAt(2); }
6101 6100
6102 HObjectAccess access() const { return access_; } 6101 HObjectAccess access() const { return access_; }
6103 HValue* new_space_dominator() const { return new_space_dominator_; } 6102 HValue* new_space_dominator() const { return new_space_dominator_; }
6104 bool has_transition() const { return has_transition_; } 6103 bool has_transition() const { return has_transition_; }
6105 6104
6106 Handle<Map> transition_map() const { 6105 Handle<Map> transition_map() const {
6107 if (has_transition()) { 6106 if (has_transition()) {
6108 return Handle<Map>::cast(HConstant::cast(transition())->handle()); 6107 return Handle<Map>::cast(
6108 HConstant::cast(transition())->handle(Isolate::Current()));
6109 } else { 6109 } else {
6110 return Handle<Map>(); 6110 return Handle<Map>();
6111 } 6111 }
6112 } 6112 }
6113 6113
6114 void SetTransition(HConstant* map_constant, CompilationInfo* info) { 6114 void SetTransition(HConstant* map_constant, CompilationInfo* info) {
6115 ASSERT(!has_transition()); // Only set once. 6115 ASSERT(!has_transition()); // Only set once.
6116 Handle<Map> map = Handle<Map>::cast(map_constant->handle()); 6116 Handle<Map> map = Handle<Map>::cast(map_constant->handle(info->isolate()));
6117 if (map->CanBeDeprecated()) { 6117 if (map->CanBeDeprecated()) {
6118 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); 6118 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info);
6119 } 6119 }
6120 SetOperandAt(2, map_constant); 6120 SetOperandAt(2, map_constant);
6121 has_transition_ = true; 6121 has_transition_ = true;
6122 } 6122 }
6123 6123
6124 bool NeedsWriteBarrier() { 6124 bool NeedsWriteBarrier() {
6125 ASSERT(!(FLAG_track_double_fields && field_representation().IsDouble()) || 6125 ASSERT(!(FLAG_track_double_fields && field_representation().IsDouble()) ||
6126 !has_transition()); 6126 !has_transition());
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
6947 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6947 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6948 }; 6948 };
6949 6949
6950 6950
6951 #undef DECLARE_INSTRUCTION 6951 #undef DECLARE_INSTRUCTION
6952 #undef DECLARE_CONCRETE_INSTRUCTION 6952 #undef DECLARE_CONCRETE_INSTRUCTION
6953 6953
6954 } } // namespace v8::internal 6954 } } // namespace v8::internal
6955 6955
6956 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6956 #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