| OLD | NEW |
| 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 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2152 HCallConstantFunction(Handle<JSFunction> function, int argument_count) | 2152 HCallConstantFunction(Handle<JSFunction> function, int argument_count) |
| 2153 : HCall<0>(argument_count), | 2153 : HCall<0>(argument_count), |
| 2154 function_(function), | 2154 function_(function), |
| 2155 formal_parameter_count_(function->shared()->formal_parameter_count()) {} | 2155 formal_parameter_count_(function->shared()->formal_parameter_count()) {} |
| 2156 | 2156 |
| 2157 Handle<JSFunction> function() const { return function_; } | 2157 Handle<JSFunction> function() const { return function_; } |
| 2158 int formal_parameter_count() const { return formal_parameter_count_; } | 2158 int formal_parameter_count() const { return formal_parameter_count_; } |
| 2159 | 2159 |
| 2160 bool IsApplyFunction() const { | 2160 bool IsApplyFunction() const { |
| 2161 return function_->code() == | 2161 return function_->code() == |
| 2162 Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply); | 2162 function_->GetIsolate()->builtins()->builtin(Builtins::kFunctionApply); |
| 2163 } | 2163 } |
| 2164 | 2164 |
| 2165 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2165 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 2166 | 2166 |
| 2167 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2167 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 2168 return Representation::None(); | 2168 return Representation::None(); |
| 2169 } | 2169 } |
| 2170 | 2170 |
| 2171 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) | 2171 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) |
| 2172 | 2172 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2622 bool has_migration_target_; | 2622 bool has_migration_target_; |
| 2623 SmallMapList map_set_; | 2623 SmallMapList map_set_; |
| 2624 ZoneList<UniqueValueId> map_unique_ids_; | 2624 ZoneList<UniqueValueId> map_unique_ids_; |
| 2625 }; | 2625 }; |
| 2626 | 2626 |
| 2627 | 2627 |
| 2628 class HCheckValue V8_FINAL : public HUnaryOperation { | 2628 class HCheckValue V8_FINAL : public HUnaryOperation { |
| 2629 public: | 2629 public: |
| 2630 static HCheckValue* New(Zone* zone, HValue* context, | 2630 static HCheckValue* New(Zone* zone, HValue* context, |
| 2631 HValue* value, Handle<JSFunction> target) { | 2631 HValue* value, Handle<JSFunction> target) { |
| 2632 bool in_new_space = Isolate::Current()->heap()->InNewSpace(*target); | 2632 bool in_new_space = zone->isolate()->heap()->InNewSpace(*target); |
| 2633 HCheckValue* check = new(zone) HCheckValue(value, target, in_new_space); | 2633 HCheckValue* check = new(zone) HCheckValue(value, target, in_new_space); |
| 2634 return check; | 2634 return check; |
| 2635 } | 2635 } |
| 2636 static HCheckValue* New(Zone* zone, HValue* context, | 2636 static HCheckValue* New(Zone* zone, HValue* context, |
| 2637 HValue* value, Handle<Map> map, UniqueValueId id) { | 2637 HValue* value, Handle<Map> map, UniqueValueId id) { |
| 2638 HCheckValue* check = new(zone) HCheckValue(value, map, false); | 2638 HCheckValue* check = new(zone) HCheckValue(value, map, false); |
| 2639 check->object_unique_id_ = id; | 2639 check->object_unique_id_ = id; |
| 2640 return check; | 2640 return check; |
| 2641 } | 2641 } |
| 2642 | 2642 |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |