| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 bool MulAndCheckOverflow(const Representation& r, Range* other); | 299 bool MulAndCheckOverflow(const Representation& r, Range* other); |
| 300 | 300 |
| 301 private: | 301 private: |
| 302 int32_t lower_; | 302 int32_t lower_; |
| 303 int32_t upper_; | 303 int32_t upper_; |
| 304 Range* next_; | 304 Range* next_; |
| 305 bool can_be_minus_zero_; | 305 bool can_be_minus_zero_; |
| 306 }; | 306 }; |
| 307 | 307 |
| 308 | 308 |
| 309 class UniqueValueId V8_FINAL { | |
| 310 public: | |
| 311 UniqueValueId() : raw_address_(NULL) { } | |
| 312 | |
| 313 explicit UniqueValueId(Handle<Object> handle) { | |
| 314 ASSERT(!AllowHeapAllocation::IsAllowed()); | |
| 315 static const Address kEmptyHandleSentinel = reinterpret_cast<Address>(1); | |
| 316 if (handle.is_null()) { | |
| 317 raw_address_ = kEmptyHandleSentinel; | |
| 318 } else { | |
| 319 raw_address_ = reinterpret_cast<Address>(*handle); | |
| 320 ASSERT_NE(kEmptyHandleSentinel, raw_address_); | |
| 321 } | |
| 322 ASSERT(IsInitialized()); | |
| 323 } | |
| 324 | |
| 325 bool IsInitialized() const { return raw_address_ != NULL; } | |
| 326 | |
| 327 bool operator==(const UniqueValueId& other) const { | |
| 328 ASSERT(IsInitialized() && other.IsInitialized()); | |
| 329 return raw_address_ == other.raw_address_; | |
| 330 } | |
| 331 | |
| 332 bool operator!=(const UniqueValueId& other) const { | |
| 333 ASSERT(IsInitialized() && other.IsInitialized()); | |
| 334 return raw_address_ != other.raw_address_; | |
| 335 } | |
| 336 | |
| 337 intptr_t Hashcode() const { | |
| 338 ASSERT(IsInitialized()); | |
| 339 return reinterpret_cast<intptr_t>(raw_address_); | |
| 340 } | |
| 341 | |
| 342 #define IMMOVABLE_UNIQUE_VALUE_ID(name) \ | |
| 343 static UniqueValueId name(Heap* heap) { return UniqueValueId(heap->name()); } | |
| 344 | |
| 345 IMMOVABLE_UNIQUE_VALUE_ID(free_space_map) | |
| 346 IMMOVABLE_UNIQUE_VALUE_ID(minus_zero_value) | |
| 347 IMMOVABLE_UNIQUE_VALUE_ID(nan_value) | |
| 348 IMMOVABLE_UNIQUE_VALUE_ID(undefined_value) | |
| 349 IMMOVABLE_UNIQUE_VALUE_ID(null_value) | |
| 350 IMMOVABLE_UNIQUE_VALUE_ID(true_value) | |
| 351 IMMOVABLE_UNIQUE_VALUE_ID(false_value) | |
| 352 IMMOVABLE_UNIQUE_VALUE_ID(the_hole_value) | |
| 353 IMMOVABLE_UNIQUE_VALUE_ID(empty_string) | |
| 354 IMMOVABLE_UNIQUE_VALUE_ID(empty_fixed_array) | |
| 355 | |
| 356 #undef IMMOVABLE_UNIQUE_VALUE_ID | |
| 357 | |
| 358 private: | |
| 359 Address raw_address_; | |
| 360 | |
| 361 explicit UniqueValueId(Object* object) { | |
| 362 raw_address_ = reinterpret_cast<Address>(object); | |
| 363 ASSERT(IsInitialized()); | |
| 364 } | |
| 365 }; | |
| 366 | |
| 367 | |
| 368 class HType V8_FINAL { | 309 class HType V8_FINAL { |
| 369 public: | 310 public: |
| 370 static HType None() { return HType(kNone); } | 311 static HType None() { return HType(kNone); } |
| 371 static HType Tagged() { return HType(kTagged); } | 312 static HType Tagged() { return HType(kTagged); } |
| 372 static HType TaggedPrimitive() { return HType(kTaggedPrimitive); } | 313 static HType TaggedPrimitive() { return HType(kTaggedPrimitive); } |
| 373 static HType TaggedNumber() { return HType(kTaggedNumber); } | 314 static HType TaggedNumber() { return HType(kTaggedNumber); } |
| 374 static HType Smi() { return HType(kSmi); } | 315 static HType Smi() { return HType(kSmi); } |
| 375 static HType HeapNumber() { return HType(kHeapNumber); } | 316 static HType HeapNumber() { return HType(kHeapNumber); } |
| 376 static HType String() { return HType(kString); } | 317 static HType String() { return HType(kString); } |
| 377 static HType Boolean() { return HType(kBoolean); } | 318 static HType Boolean() { return HType(kBoolean); } |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 // This gives the instruction an opportunity to replace itself with an | 838 // This gives the instruction an opportunity to replace itself with an |
| 898 // instruction that does the same in some better way. To replace an | 839 // instruction that does the same in some better way. To replace an |
| 899 // instruction with a new one, first add the new instruction to the graph, | 840 // instruction with a new one, first add the new instruction to the graph, |
| 900 // then return it. Return NULL to have the instruction deleted. | 841 // then return it. Return NULL to have the instruction deleted. |
| 901 virtual HValue* Canonicalize() { return this; } | 842 virtual HValue* Canonicalize() { return this; } |
| 902 | 843 |
| 903 bool Equals(HValue* other); | 844 bool Equals(HValue* other); |
| 904 virtual intptr_t Hashcode(); | 845 virtual intptr_t Hashcode(); |
| 905 | 846 |
| 906 // Compute unique ids upfront that is safe wrt GC and concurrent compilation. | 847 // Compute unique ids upfront that is safe wrt GC and concurrent compilation. |
| 907 virtual void FinalizeUniqueValueId() { } | 848 virtual void FinalizeUniqueness() { } |
| 908 | 849 |
| 909 // Printing support. | 850 // Printing support. |
| 910 virtual void PrintTo(StringStream* stream) = 0; | 851 virtual void PrintTo(StringStream* stream) = 0; |
| 911 void PrintNameTo(StringStream* stream); | 852 void PrintNameTo(StringStream* stream); |
| 912 void PrintTypeTo(StringStream* stream); | 853 void PrintTypeTo(StringStream* stream); |
| 913 void PrintRangeTo(StringStream* stream); | 854 void PrintRangeTo(StringStream* stream); |
| 914 void PrintChangesTo(StringStream* stream); | 855 void PrintChangesTo(StringStream* stream); |
| 915 | 856 |
| 916 const char* Mnemonic() const; | 857 const char* Mnemonic() const; |
| 917 | 858 |
| (...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2684 Unique<JSFunction> target = Unique<JSFunction>::CreateUninitialized(func); | 2625 Unique<JSFunction> target = Unique<JSFunction>::CreateUninitialized(func); |
| 2685 HCheckValue* check = new(zone) HCheckValue(value, target, in_new_space); | 2626 HCheckValue* check = new(zone) HCheckValue(value, target, in_new_space); |
| 2686 return check; | 2627 return check; |
| 2687 } | 2628 } |
| 2688 static HCheckValue* New(Zone* zone, HValue* context, | 2629 static HCheckValue* New(Zone* zone, HValue* context, |
| 2689 HValue* value, Unique<HeapObject> target, | 2630 HValue* value, Unique<HeapObject> target, |
| 2690 bool object_in_new_space) { | 2631 bool object_in_new_space) { |
| 2691 return new(zone) HCheckValue(value, target, object_in_new_space); | 2632 return new(zone) HCheckValue(value, target, object_in_new_space); |
| 2692 } | 2633 } |
| 2693 | 2634 |
| 2694 virtual void FinalizeUniqueValueId() V8_OVERRIDE { | 2635 virtual void FinalizeUniqueness() V8_OVERRIDE { |
| 2695 object_ = Unique<HeapObject>(object_.handle()); | 2636 object_ = Unique<HeapObject>(object_.handle()); |
| 2696 } | 2637 } |
| 2697 | 2638 |
| 2698 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2639 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 2699 return Representation::Tagged(); | 2640 return Representation::Tagged(); |
| 2700 } | 2641 } |
| 2701 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2642 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 2702 | 2643 |
| 2703 virtual HValue* Canonicalize() V8_OVERRIDE; | 2644 virtual HValue* Canonicalize() V8_OVERRIDE; |
| 2704 | 2645 |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3290 int capture_id_; | 3231 int capture_id_; |
| 3291 }; | 3232 }; |
| 3292 | 3233 |
| 3293 | 3234 |
| 3294 class HConstant V8_FINAL : public HTemplateInstruction<0> { | 3235 class HConstant V8_FINAL : public HTemplateInstruction<0> { |
| 3295 public: | 3236 public: |
| 3296 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); | 3237 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); |
| 3297 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); | 3238 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); |
| 3298 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); | 3239 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); |
| 3299 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); | 3240 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); |
| 3300 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, Handle<Map>, UniqueValueId); | |
| 3301 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); | 3241 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); |
| 3302 | 3242 |
| 3303 static HConstant* CreateAndInsertAfter(Zone* zone, | 3243 static HConstant* CreateAndInsertAfter(Zone* zone, |
| 3304 HValue* context, | 3244 HValue* context, |
| 3305 int32_t value, | 3245 int32_t value, |
| 3306 Representation representation, | 3246 Representation representation, |
| 3307 HInstruction* instruction) { | 3247 HInstruction* instruction) { |
| 3308 HConstant* new_constant = | 3248 HConstant* new_constant = |
| 3309 HConstant::New(zone, context, value, representation); | 3249 HConstant::New(zone, context, value, representation); |
| 3310 new_constant->InsertAfter(instruction); | 3250 new_constant->InsertAfter(instruction); |
| 3311 return new_constant; | 3251 return new_constant; |
| 3312 } | 3252 } |
| 3313 | 3253 |
| 3314 static HConstant* CreateAndInsertBefore(Zone* zone, | 3254 static HConstant* CreateAndInsertBefore(Zone* zone, |
| 3315 HValue* context, | 3255 HValue* context, |
| 3316 int32_t value, | 3256 int32_t value, |
| 3317 Representation representation, | 3257 Representation representation, |
| 3318 HInstruction* instruction) { | 3258 HInstruction* instruction) { |
| 3319 HConstant* new_constant = | 3259 HConstant* new_constant = |
| 3320 HConstant::New(zone, context, value, representation); | 3260 HConstant::New(zone, context, value, representation); |
| 3321 new_constant->InsertBefore(instruction); | 3261 new_constant->InsertBefore(instruction); |
| 3322 return new_constant; | 3262 return new_constant; |
| 3323 } | 3263 } |
| 3324 | 3264 |
| 3325 Handle<Object> handle(Isolate* isolate) { | 3265 Handle<Object> handle(Isolate* isolate) { |
| 3326 if (handle_.is_null()) { | 3266 if (object_.handle().is_null()) { |
| 3327 Factory* factory = isolate->factory(); | |
| 3328 // Default arguments to is_not_in_new_space depend on this heap number | 3267 // Default arguments to is_not_in_new_space depend on this heap number |
| 3329 // to be tenured so that it's guaranteed not be be located in new space. | 3268 // to be tenured so that it's guaranteed not to be located in new space. |
| 3330 handle_ = factory->NewNumber(double_value_, TENURED); | 3269 object_ = Unique<Object>::CreateUninitialized( |
| 3270 isolate->factory()->NewNumber(double_value_, TENURED)); |
| 3331 } | 3271 } |
| 3332 AllowDeferredHandleDereference smi_check; | 3272 AllowDeferredHandleDereference smi_check; |
| 3333 ASSERT(has_int32_value_ || !handle_->IsSmi()); | 3273 ASSERT(has_int32_value_ || !object_.handle()->IsSmi()); |
| 3334 return handle_; | 3274 return object_.handle(); |
| 3335 } | 3275 } |
| 3336 | 3276 |
| 3337 bool HasMap(Handle<Map> map) { | 3277 bool HasMap(Handle<Map> map) { |
| 3338 Handle<Object> constant_object = handle(map->GetIsolate()); | 3278 Handle<Object> constant_object = handle(map->GetIsolate()); |
| 3339 return constant_object->IsHeapObject() && | 3279 return constant_object->IsHeapObject() && |
| 3340 Handle<HeapObject>::cast(constant_object)->map() == *map; | 3280 Handle<HeapObject>::cast(constant_object)->map() == *map; |
| 3341 } | 3281 } |
| 3342 | 3282 |
| 3343 bool IsSpecialDouble() const { | 3283 bool IsSpecialDouble() const { |
| 3344 return has_double_value_ && | 3284 return has_double_value_ && |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3358 if (has_double_value_) { | 3298 if (has_double_value_) { |
| 3359 if (IsSpecialDouble()) { | 3299 if (IsSpecialDouble()) { |
| 3360 return true; | 3300 return true; |
| 3361 } | 3301 } |
| 3362 return false; | 3302 return false; |
| 3363 } | 3303 } |
| 3364 if (has_external_reference_value_) { | 3304 if (has_external_reference_value_) { |
| 3365 return false; | 3305 return false; |
| 3366 } | 3306 } |
| 3367 | 3307 |
| 3368 ASSERT(!handle_.is_null()); | 3308 ASSERT(!object_.handle().is_null()); |
| 3369 Heap* heap = isolate()->heap(); | 3309 Heap* heap = isolate()->heap(); |
| 3370 ASSERT(unique_id_ != UniqueValueId::minus_zero_value(heap)); | 3310 ASSERT(!object_.IsKnownGlobal(heap->minus_zero_value())); |
| 3371 ASSERT(unique_id_ != UniqueValueId::nan_value(heap)); | 3311 ASSERT(!object_.IsKnownGlobal(heap->nan_value())); |
| 3372 return unique_id_ == UniqueValueId::undefined_value(heap) || | 3312 return |
| 3373 unique_id_ == UniqueValueId::null_value(heap) || | 3313 object_.IsKnownGlobal(heap->undefined_value()) || |
| 3374 unique_id_ == UniqueValueId::true_value(heap) || | 3314 object_.IsKnownGlobal(heap->null_value()) || |
| 3375 unique_id_ == UniqueValueId::false_value(heap) || | 3315 object_.IsKnownGlobal(heap->true_value()) || |
| 3376 unique_id_ == UniqueValueId::the_hole_value(heap) || | 3316 object_.IsKnownGlobal(heap->false_value()) || |
| 3377 unique_id_ == UniqueValueId::empty_string(heap) || | 3317 object_.IsKnownGlobal(heap->the_hole_value()) || |
| 3378 unique_id_ == UniqueValueId::empty_fixed_array(heap); | 3318 object_.IsKnownGlobal(heap->empty_string()) || |
| 3319 object_.IsKnownGlobal(heap->empty_fixed_array()); |
| 3379 } | 3320 } |
| 3380 | 3321 |
| 3381 bool IsCell() const { | 3322 bool IsCell() const { |
| 3382 return is_cell_; | 3323 return is_cell_; |
| 3383 } | 3324 } |
| 3384 | 3325 |
| 3385 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3326 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 3386 return Representation::None(); | 3327 return Representation::None(); |
| 3387 } | 3328 } |
| 3388 | 3329 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3407 bool HasSmiValue() const { return has_smi_value_; } | 3348 bool HasSmiValue() const { return has_smi_value_; } |
| 3408 bool HasDoubleValue() const { return has_double_value_; } | 3349 bool HasDoubleValue() const { return has_double_value_; } |
| 3409 double DoubleValue() const { | 3350 double DoubleValue() const { |
| 3410 ASSERT(HasDoubleValue()); | 3351 ASSERT(HasDoubleValue()); |
| 3411 return double_value_; | 3352 return double_value_; |
| 3412 } | 3353 } |
| 3413 bool IsTheHole() const { | 3354 bool IsTheHole() const { |
| 3414 if (HasDoubleValue() && FixedDoubleArray::is_the_hole_nan(double_value_)) { | 3355 if (HasDoubleValue() && FixedDoubleArray::is_the_hole_nan(double_value_)) { |
| 3415 return true; | 3356 return true; |
| 3416 } | 3357 } |
| 3417 Heap* heap = isolate()->heap(); | 3358 return object_.IsKnownGlobal(isolate()->heap()->the_hole_value()); |
| 3418 if (!handle_.is_null() && *handle_ == heap->the_hole_value()) { | |
| 3419 return true; | |
| 3420 } | |
| 3421 return false; | |
| 3422 } | 3359 } |
| 3423 bool HasNumberValue() const { return has_double_value_; } | 3360 bool HasNumberValue() const { return has_double_value_; } |
| 3424 int32_t NumberValueAsInteger32() const { | 3361 int32_t NumberValueAsInteger32() const { |
| 3425 ASSERT(HasNumberValue()); | 3362 ASSERT(HasNumberValue()); |
| 3426 // Irrespective of whether a numeric HConstant can be safely | 3363 // Irrespective of whether a numeric HConstant can be safely |
| 3427 // represented as an int32, we store the (in some cases lossy) | 3364 // represented as an int32, we store the (in some cases lossy) |
| 3428 // representation of the number in int32_value_. | 3365 // representation of the number in int32_value_. |
| 3429 return int32_value_; | 3366 return int32_value_; |
| 3430 } | 3367 } |
| 3431 bool HasStringValue() const { | 3368 bool HasStringValue() const { |
| 3432 if (has_double_value_ || has_int32_value_) return false; | 3369 if (has_double_value_ || has_int32_value_) return false; |
| 3433 ASSERT(!handle_.is_null()); | 3370 ASSERT(!object_.handle().is_null()); |
| 3434 return type_.IsString(); | 3371 return type_.IsString(); |
| 3435 } | 3372 } |
| 3436 Handle<String> StringValue() const { | 3373 Handle<String> StringValue() const { |
| 3437 ASSERT(HasStringValue()); | 3374 ASSERT(HasStringValue()); |
| 3438 return Handle<String>::cast(handle_); | 3375 return Handle<String>::cast(object_.handle()); |
| 3439 } | 3376 } |
| 3440 bool HasInternalizedStringValue() const { | 3377 bool HasInternalizedStringValue() const { |
| 3441 return HasStringValue() && is_internalized_string_; | 3378 return HasStringValue() && is_internalized_string_; |
| 3442 } | 3379 } |
| 3443 | 3380 |
| 3444 bool HasExternalReferenceValue() const { | 3381 bool HasExternalReferenceValue() const { |
| 3445 return has_external_reference_value_; | 3382 return has_external_reference_value_; |
| 3446 } | 3383 } |
| 3447 ExternalReference ExternalReferenceValue() const { | 3384 ExternalReference ExternalReferenceValue() const { |
| 3448 return external_reference_value_; | 3385 return external_reference_value_; |
| 3449 } | 3386 } |
| 3450 | 3387 |
| 3451 bool HasBooleanValue() const { return type_.IsBoolean(); } | 3388 bool HasBooleanValue() const { return type_.IsBoolean(); } |
| 3452 bool BooleanValue() const { return boolean_value_; } | 3389 bool BooleanValue() const { return boolean_value_; } |
| 3453 | 3390 |
| 3454 virtual intptr_t Hashcode() V8_OVERRIDE { | 3391 virtual intptr_t Hashcode() V8_OVERRIDE { |
| 3455 if (has_int32_value_) { | 3392 if (has_int32_value_) { |
| 3456 return static_cast<intptr_t>(int32_value_); | 3393 return static_cast<intptr_t>(int32_value_); |
| 3457 } else if (has_double_value_) { | 3394 } else if (has_double_value_) { |
| 3458 return static_cast<intptr_t>(BitCast<int64_t>(double_value_)); | 3395 return static_cast<intptr_t>(BitCast<int64_t>(double_value_)); |
| 3459 } else if (has_external_reference_value_) { | 3396 } else if (has_external_reference_value_) { |
| 3460 return reinterpret_cast<intptr_t>(external_reference_value_.address()); | 3397 return reinterpret_cast<intptr_t>(external_reference_value_.address()); |
| 3461 } else { | 3398 } else { |
| 3462 ASSERT(!handle_.is_null()); | 3399 ASSERT(!object_.handle().is_null()); |
| 3463 return unique_id_.Hashcode(); | 3400 return object_.Hashcode(); |
| 3464 } | 3401 } |
| 3465 } | 3402 } |
| 3466 | 3403 |
| 3467 virtual void FinalizeUniqueValueId() V8_OVERRIDE { | 3404 virtual void FinalizeUniqueness() V8_OVERRIDE { |
| 3468 if (!has_double_value_ && !has_external_reference_value_) { | 3405 if (!has_double_value_ && !has_external_reference_value_) { |
| 3469 ASSERT(!handle_.is_null()); | 3406 ASSERT(!object_.handle().is_null()); |
| 3470 unique_id_ = UniqueValueId(handle_); | 3407 object_ = Unique<Object>(object_.handle()); |
| 3471 } | 3408 } |
| 3472 } | 3409 } |
| 3473 | 3410 |
| 3474 bool UniqueValueIdsMatch(UniqueValueId other) { | |
| 3475 return !has_double_value_ && !has_external_reference_value_ && | |
| 3476 unique_id_ == other; | |
| 3477 } | |
| 3478 | |
| 3479 Unique<Object> GetUnique() const { | 3411 Unique<Object> GetUnique() const { |
| 3480 // TODO(titzer): store a Unique<HeapObject> inside the HConstant. | 3412 return object_; |
| 3481 Address raw_address = reinterpret_cast<Address>(unique_id_.Hashcode()); | |
| 3482 return Unique<Object>(raw_address, handle_); | |
| 3483 } | 3413 } |
| 3484 | 3414 |
| 3485 #ifdef DEBUG | 3415 #ifdef DEBUG |
| 3486 virtual void Verify() V8_OVERRIDE { } | 3416 virtual void Verify() V8_OVERRIDE { } |
| 3487 #endif | 3417 #endif |
| 3488 | 3418 |
| 3489 DECLARE_CONCRETE_INSTRUCTION(Constant) | 3419 DECLARE_CONCRETE_INSTRUCTION(Constant) |
| 3490 | 3420 |
| 3491 protected: | 3421 protected: |
| 3492 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 3422 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
| 3493 | 3423 |
| 3494 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 3424 virtual bool DataEquals(HValue* other) V8_OVERRIDE { |
| 3495 HConstant* other_constant = HConstant::cast(other); | 3425 HConstant* other_constant = HConstant::cast(other); |
| 3496 if (has_int32_value_) { | 3426 if (has_int32_value_) { |
| 3497 return other_constant->has_int32_value_ && | 3427 return other_constant->has_int32_value_ && |
| 3498 int32_value_ == other_constant->int32_value_; | 3428 int32_value_ == other_constant->int32_value_; |
| 3499 } else if (has_double_value_) { | 3429 } else if (has_double_value_) { |
| 3500 return other_constant->has_double_value_ && | 3430 return other_constant->has_double_value_ && |
| 3501 BitCast<int64_t>(double_value_) == | 3431 BitCast<int64_t>(double_value_) == |
| 3502 BitCast<int64_t>(other_constant->double_value_); | 3432 BitCast<int64_t>(other_constant->double_value_); |
| 3503 } else if (has_external_reference_value_) { | 3433 } else if (has_external_reference_value_) { |
| 3504 return other_constant->has_external_reference_value_ && | 3434 return other_constant->has_external_reference_value_ && |
| 3505 external_reference_value_ == | 3435 external_reference_value_ == |
| 3506 other_constant->external_reference_value_; | 3436 other_constant->external_reference_value_; |
| 3507 } else { | 3437 } else { |
| 3508 ASSERT(!handle_.is_null()); | 3438 ASSERT(!object_.handle().is_null()); |
| 3509 return !other_constant->handle_.is_null() && | 3439 return other_constant->object_ == object_; |
| 3510 unique_id_ == other_constant->unique_id_; | |
| 3511 } | 3440 } |
| 3512 } | 3441 } |
| 3513 | 3442 |
| 3514 private: | 3443 private: |
| 3515 friend class HGraph; | 3444 friend class HGraph; |
| 3516 HConstant(Handle<Object> handle, Representation r = Representation::None()); | 3445 HConstant(Handle<Object> handle, Representation r = Representation::None()); |
| 3517 HConstant(int32_t value, | 3446 HConstant(int32_t value, |
| 3518 Representation r = Representation::None(), | 3447 Representation r = Representation::None(), |
| 3519 bool is_not_in_new_space = true, | 3448 bool is_not_in_new_space = true, |
| 3520 Handle<Object> optional_handle = Handle<Object>::null()); | 3449 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); |
| 3521 HConstant(double value, | 3450 HConstant(double value, |
| 3522 Representation r = Representation::None(), | 3451 Representation r = Representation::None(), |
| 3523 bool is_not_in_new_space = true, | 3452 bool is_not_in_new_space = true, |
| 3524 Handle<Object> optional_handle = Handle<Object>::null()); | 3453 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); |
| 3525 HConstant(Handle<Object> handle, | 3454 HConstant(Unique<Object> unique, |
| 3526 UniqueValueId unique_id, | |
| 3527 Representation r, | 3455 Representation r, |
| 3528 HType type, | 3456 HType type, |
| 3529 bool is_internalized_string, | 3457 bool is_internalized_string, |
| 3530 bool is_not_in_new_space, | 3458 bool is_not_in_new_space, |
| 3531 bool is_cell, | 3459 bool is_cell, |
| 3532 bool boolean_value); | 3460 bool boolean_value); |
| 3533 HConstant(Handle<Map> handle, | 3461 |
| 3534 UniqueValueId unique_id); | |
| 3535 explicit HConstant(ExternalReference reference); | 3462 explicit HConstant(ExternalReference reference); |
| 3536 | 3463 |
| 3537 void Initialize(Representation r); | 3464 void Initialize(Representation r); |
| 3538 | 3465 |
| 3539 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 3466 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 3540 | 3467 |
| 3541 // If this is a numerical constant, handle_ either points to to the | 3468 // If this is a numerical constant, object_ either points to the |
| 3542 // HeapObject the constant originated from or is null. If the | 3469 // HeapObject the constant originated from or is null. If the |
| 3543 // constant is non-numeric, handle_ always points to a valid | 3470 // constant is non-numeric, object_ always points to a valid |
| 3544 // constant HeapObject. | 3471 // constant HeapObject. |
| 3545 Handle<Object> handle_; | 3472 Unique<Object> object_; |
| 3546 UniqueValueId unique_id_; | |
| 3547 | 3473 |
| 3548 // We store the HConstant in the most specific form safely possible. | 3474 // We store the HConstant in the most specific form safely possible. |
| 3549 // The two flags, has_int32_value_ and has_double_value_ tell us if | 3475 // The two flags, has_int32_value_ and has_double_value_ tell us if |
| 3550 // int32_value_ and double_value_ hold valid, safe representations | 3476 // int32_value_ and double_value_ hold valid, safe representations |
| 3551 // of the constant. has_int32_value_ implies has_double_value_ but | 3477 // of the constant. has_int32_value_ implies has_double_value_ but |
| 3552 // not the converse. | 3478 // not the converse. |
| 3553 bool has_smi_value_ : 1; | 3479 bool has_smi_value_ : 1; |
| 3554 bool has_int32_value_ : 1; | 3480 bool has_int32_value_ : 1; |
| 3555 bool has_double_value_ : 1; | 3481 bool has_double_value_ : 1; |
| 3556 bool has_external_reference_value_ : 1; | 3482 bool has_external_reference_value_ : 1; |
| (...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4954 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4880 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
| 4955 | 4881 |
| 4956 private: | 4882 private: |
| 4957 HSar(HValue* context, HValue* left, HValue* right) | 4883 HSar(HValue* context, HValue* left, HValue* right) |
| 4958 : HBitwiseBinaryOperation(context, left, right) { } | 4884 : HBitwiseBinaryOperation(context, left, right) { } |
| 4959 }; | 4885 }; |
| 4960 | 4886 |
| 4961 | 4887 |
| 4962 class HRor V8_FINAL : public HBitwiseBinaryOperation { | 4888 class HRor V8_FINAL : public HBitwiseBinaryOperation { |
| 4963 public: | 4889 public: |
| 4964 HRor(HValue* context, HValue* left, HValue* right) | 4890 static HInstruction* New(Zone* zone, |
| 4965 : HBitwiseBinaryOperation(context, left, right) { | 4891 HValue* context, |
| 4966 ChangeRepresentation(Representation::Integer32()); | 4892 HValue* left, |
| 4893 HValue* right) { |
| 4894 return new(zone) HRor(context, left, right); |
| 4967 } | 4895 } |
| 4968 | 4896 |
| 4969 virtual void UpdateRepresentation(Representation new_rep, | 4897 virtual void UpdateRepresentation(Representation new_rep, |
| 4970 HInferRepresentationPhase* h_infer, | 4898 HInferRepresentationPhase* h_infer, |
| 4971 const char* reason) V8_OVERRIDE { | 4899 const char* reason) V8_OVERRIDE { |
| 4972 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4900 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
| 4973 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4901 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 4974 } | 4902 } |
| 4975 | 4903 |
| 4976 DECLARE_CONCRETE_INSTRUCTION(Ror) | 4904 DECLARE_CONCRETE_INSTRUCTION(Ror) |
| 4977 | 4905 |
| 4978 protected: | 4906 protected: |
| 4979 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4907 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
| 4908 |
| 4909 private: |
| 4910 HRor(HValue* context, HValue* left, HValue* right) |
| 4911 : HBitwiseBinaryOperation(context, left, right) { |
| 4912 ChangeRepresentation(Representation::Integer32()); |
| 4913 } |
| 4980 }; | 4914 }; |
| 4981 | 4915 |
| 4982 | 4916 |
| 4983 class HOsrEntry V8_FINAL : public HTemplateInstruction<0> { | 4917 class HOsrEntry V8_FINAL : public HTemplateInstruction<0> { |
| 4984 public: | 4918 public: |
| 4985 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); | 4919 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); |
| 4986 | 4920 |
| 4987 BailoutId ast_id() const { return ast_id_; } | 4921 BailoutId ast_id() const { return ast_id_; } |
| 4988 | 4922 |
| 4989 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4923 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5107 | 5041 |
| 5108 HEnvironment* environment_; | 5042 HEnvironment* environment_; |
| 5109 int index_; | 5043 int index_; |
| 5110 HPhi* incoming_value_; | 5044 HPhi* incoming_value_; |
| 5111 }; | 5045 }; |
| 5112 | 5046 |
| 5113 | 5047 |
| 5114 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> { | 5048 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> { |
| 5115 public: | 5049 public: |
| 5116 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) | 5050 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) |
| 5117 : cell_(cell), details_(details), unique_id_() { | 5051 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) { |
| 5118 set_representation(Representation::Tagged()); | 5052 set_representation(Representation::Tagged()); |
| 5119 SetFlag(kUseGVN); | 5053 SetFlag(kUseGVN); |
| 5120 SetGVNFlag(kDependsOnGlobalVars); | 5054 SetGVNFlag(kDependsOnGlobalVars); |
| 5121 } | 5055 } |
| 5122 | 5056 |
| 5123 Handle<Cell> cell() const { return cell_; } | 5057 Unique<Cell> cell() const { return cell_; } |
| 5124 bool RequiresHoleCheck() const; | 5058 bool RequiresHoleCheck() const; |
| 5125 | 5059 |
| 5126 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5060 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 5127 | 5061 |
| 5128 virtual intptr_t Hashcode() V8_OVERRIDE { | 5062 virtual intptr_t Hashcode() V8_OVERRIDE { |
| 5129 return unique_id_.Hashcode(); | 5063 return cell_.Hashcode(); |
| 5130 } | 5064 } |
| 5131 | 5065 |
| 5132 virtual void FinalizeUniqueValueId() V8_OVERRIDE { | 5066 virtual void FinalizeUniqueness() V8_OVERRIDE { |
| 5133 unique_id_ = UniqueValueId(cell_); | 5067 cell_ = Unique<Cell>(cell_.handle()); |
| 5134 } | 5068 } |
| 5135 | 5069 |
| 5136 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5070 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 5137 return Representation::None(); | 5071 return Representation::None(); |
| 5138 } | 5072 } |
| 5139 | 5073 |
| 5140 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) | 5074 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) |
| 5141 | 5075 |
| 5142 protected: | 5076 protected: |
| 5143 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 5077 virtual bool DataEquals(HValue* other) V8_OVERRIDE { |
| 5144 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); | 5078 return cell_ == HLoadGlobalCell::cast(other)->cell_; |
| 5145 return unique_id_ == b->unique_id_; | |
| 5146 } | 5079 } |
| 5147 | 5080 |
| 5148 private: | 5081 private: |
| 5149 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); } | 5082 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); } |
| 5150 | 5083 |
| 5151 Handle<Cell> cell_; | 5084 Unique<Cell> cell_; |
| 5152 PropertyDetails details_; | 5085 PropertyDetails details_; |
| 5153 UniqueValueId unique_id_; | |
| 5154 }; | 5086 }; |
| 5155 | 5087 |
| 5156 | 5088 |
| 5157 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { | 5089 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { |
| 5158 public: | 5090 public: |
| 5159 HLoadGlobalGeneric(HValue* context, | 5091 HLoadGlobalGeneric(HValue* context, |
| 5160 HValue* global_object, | 5092 HValue* global_object, |
| 5161 Handle<Object> name, | 5093 Handle<Object> name, |
| 5162 bool for_typeof) | 5094 bool for_typeof) |
| 5163 : name_(name), | 5095 : name_(name), |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5414 } | 5346 } |
| 5415 return true; | 5347 return true; |
| 5416 } | 5348 } |
| 5417 | 5349 |
| 5418 | 5350 |
| 5419 class HStoreGlobalCell V8_FINAL : public HUnaryOperation { | 5351 class HStoreGlobalCell V8_FINAL : public HUnaryOperation { |
| 5420 public: | 5352 public: |
| 5421 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, | 5353 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, |
| 5422 Handle<PropertyCell>, PropertyDetails); | 5354 Handle<PropertyCell>, PropertyDetails); |
| 5423 | 5355 |
| 5424 Handle<PropertyCell> cell() const { return cell_; } | 5356 Unique<PropertyCell> cell() const { return cell_; } |
| 5425 bool RequiresHoleCheck() { | 5357 bool RequiresHoleCheck() { |
| 5426 return !details_.IsDontDelete() || details_.IsReadOnly(); | 5358 return !details_.IsDontDelete() || details_.IsReadOnly(); |
| 5427 } | 5359 } |
| 5428 bool NeedsWriteBarrier() { | 5360 bool NeedsWriteBarrier() { |
| 5429 return StoringValueNeedsWriteBarrier(value()); | 5361 return StoringValueNeedsWriteBarrier(value()); |
| 5430 } | 5362 } |
| 5431 | 5363 |
| 5364 virtual void FinalizeUniqueness() V8_OVERRIDE { |
| 5365 cell_ = Unique<PropertyCell>(cell_.handle()); |
| 5366 } |
| 5367 |
| 5432 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5368 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 5433 return Representation::Tagged(); | 5369 return Representation::Tagged(); |
| 5434 } | 5370 } |
| 5435 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5371 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 5436 | 5372 |
| 5437 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) | 5373 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) |
| 5438 | 5374 |
| 5439 private: | 5375 private: |
| 5440 HStoreGlobalCell(HValue* value, | 5376 HStoreGlobalCell(HValue* value, |
| 5441 Handle<PropertyCell> cell, | 5377 Handle<PropertyCell> cell, |
| 5442 PropertyDetails details) | 5378 PropertyDetails details) |
| 5443 : HUnaryOperation(value), | 5379 : HUnaryOperation(value), |
| 5444 cell_(cell), | 5380 cell_(Unique<PropertyCell>::CreateUninitialized(cell)), |
| 5445 details_(details) { | 5381 details_(details) { |
| 5446 SetGVNFlag(kChangesGlobalVars); | 5382 SetGVNFlag(kChangesGlobalVars); |
| 5447 } | 5383 } |
| 5448 | 5384 |
| 5449 Handle<PropertyCell> cell_; | 5385 Unique<PropertyCell> cell_; |
| 5450 PropertyDetails details_; | 5386 PropertyDetails details_; |
| 5451 }; | 5387 }; |
| 5452 | 5388 |
| 5453 | 5389 |
| 5454 class HStoreGlobalGeneric : public HTemplateInstruction<3> { | 5390 class HStoreGlobalGeneric : public HTemplateInstruction<3> { |
| 5455 public: | 5391 public: |
| 5456 inline static HStoreGlobalGeneric* New(Zone* zone, | 5392 inline static HStoreGlobalGeneric* New(Zone* zone, |
| 5457 HValue* context, | 5393 HValue* context, |
| 5458 HValue* global_object, | 5394 HValue* global_object, |
| 5459 Handle<Object> name, | 5395 Handle<Object> name, |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5650 | 5586 |
| 5651 inline HObjectAccess WithRepresentation(Representation representation) { | 5587 inline HObjectAccess WithRepresentation(Representation representation) { |
| 5652 return HObjectAccess(portion(), offset(), representation, name()); | 5588 return HObjectAccess(portion(), offset(), representation, name()); |
| 5653 } | 5589 } |
| 5654 | 5590 |
| 5655 static HObjectAccess ForHeapNumberValue() { | 5591 static HObjectAccess ForHeapNumberValue() { |
| 5656 return HObjectAccess( | 5592 return HObjectAccess( |
| 5657 kDouble, HeapNumber::kValueOffset, Representation::Double()); | 5593 kDouble, HeapNumber::kValueOffset, Representation::Double()); |
| 5658 } | 5594 } |
| 5659 | 5595 |
| 5596 static HObjectAccess ForHeapNumberValueLowestBits() { |
| 5597 return HObjectAccess(kDouble, |
| 5598 HeapNumber::kValueOffset, |
| 5599 Representation::Integer32()); |
| 5600 } |
| 5601 |
| 5602 static HObjectAccess ForHeapNumberValueHighestBits() { |
| 5603 return HObjectAccess(kDouble, |
| 5604 HeapNumber::kValueOffset + kIntSize, |
| 5605 Representation::Integer32()); |
| 5606 } |
| 5607 |
| 5660 static HObjectAccess ForElementsPointer() { | 5608 static HObjectAccess ForElementsPointer() { |
| 5661 return HObjectAccess(kElementsPointer, JSObject::kElementsOffset); | 5609 return HObjectAccess(kElementsPointer, JSObject::kElementsOffset); |
| 5662 } | 5610 } |
| 5663 | 5611 |
| 5664 static HObjectAccess ForLiteralsPointer() { | 5612 static HObjectAccess ForLiteralsPointer() { |
| 5665 return HObjectAccess(kInobject, JSFunction::kLiteralsOffset); | 5613 return HObjectAccess(kInobject, JSFunction::kLiteralsOffset); |
| 5666 } | 5614 } |
| 5667 | 5615 |
| 5668 static HObjectAccess ForNextFunctionLinkPointer() { | 5616 static HObjectAccess ForNextFunctionLinkPointer() { |
| 5669 return HObjectAccess(kInobject, JSFunction::kNextFunctionLinkOffset); | 5617 return HObjectAccess(kInobject, JSFunction::kNextFunctionLinkOffset); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5682 return HObjectAccess( | 5630 return HObjectAccess( |
| 5683 kInobject, | 5631 kInobject, |
| 5684 JSTypedArray::kLengthOffset, | 5632 JSTypedArray::kLengthOffset, |
| 5685 Representation::Tagged()); | 5633 Representation::Tagged()); |
| 5686 } | 5634 } |
| 5687 | 5635 |
| 5688 static HObjectAccess ForAllocationSiteTransitionInfo() { | 5636 static HObjectAccess ForAllocationSiteTransitionInfo() { |
| 5689 return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset); | 5637 return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset); |
| 5690 } | 5638 } |
| 5691 | 5639 |
| 5640 static HObjectAccess ForAllocationSiteNestedSite() { |
| 5641 return HObjectAccess(kInobject, AllocationSite::kNestedSiteOffset); |
| 5642 } |
| 5643 |
| 5692 static HObjectAccess ForAllocationSiteDependentCode() { | 5644 static HObjectAccess ForAllocationSiteDependentCode() { |
| 5693 return HObjectAccess(kInobject, AllocationSite::kDependentCodeOffset); | 5645 return HObjectAccess(kInobject, AllocationSite::kDependentCodeOffset); |
| 5694 } | 5646 } |
| 5695 | 5647 |
| 5696 static HObjectAccess ForAllocationSiteWeakNext() { | 5648 static HObjectAccess ForAllocationSiteWeakNext() { |
| 5697 return HObjectAccess(kInobject, AllocationSite::kWeakNextOffset); | 5649 return HObjectAccess(kInobject, AllocationSite::kWeakNextOffset); |
| 5698 } | 5650 } |
| 5699 | 5651 |
| 5700 static HObjectAccess ForAllocationSiteList() { | 5652 static HObjectAccess ForAllocationSiteList() { |
| 5701 return HObjectAccess(kExternalMemory, 0, Representation::Tagged()); | 5653 return HObjectAccess(kExternalMemory, 0, Representation::Tagged()); |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6498 return new(zone) HTransitionElementsKind(context, object, | 6450 return new(zone) HTransitionElementsKind(context, object, |
| 6499 original_map, transitioned_map); | 6451 original_map, transitioned_map); |
| 6500 } | 6452 } |
| 6501 | 6453 |
| 6502 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6454 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 6503 return Representation::Tagged(); | 6455 return Representation::Tagged(); |
| 6504 } | 6456 } |
| 6505 | 6457 |
| 6506 HValue* object() { return OperandAt(0); } | 6458 HValue* object() { return OperandAt(0); } |
| 6507 HValue* context() { return OperandAt(1); } | 6459 HValue* context() { return OperandAt(1); } |
| 6508 Handle<Map> original_map() { return original_map_; } | 6460 Unique<Map> original_map() { return original_map_; } |
| 6509 Handle<Map> transitioned_map() { return transitioned_map_; } | 6461 Unique<Map> transitioned_map() { return transitioned_map_; } |
| 6510 ElementsKind from_kind() { return from_kind_; } | 6462 ElementsKind from_kind() { return from_kind_; } |
| 6511 ElementsKind to_kind() { return to_kind_; } | 6463 ElementsKind to_kind() { return to_kind_; } |
| 6512 | 6464 |
| 6513 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6465 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 6514 | 6466 |
| 6515 virtual void FinalizeUniqueValueId() V8_OVERRIDE { | |
| 6516 original_map_unique_id_ = UniqueValueId(original_map_); | |
| 6517 transitioned_map_unique_id_ = UniqueValueId(transitioned_map_); | |
| 6518 } | |
| 6519 | |
| 6520 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) | 6467 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) |
| 6521 | 6468 |
| 6522 protected: | 6469 protected: |
| 6523 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 6470 virtual bool DataEquals(HValue* other) V8_OVERRIDE { |
| 6524 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); | 6471 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); |
| 6525 return original_map_unique_id_ == instr->original_map_unique_id_ && | 6472 return original_map_ == instr->original_map_ && |
| 6526 transitioned_map_unique_id_ == instr->transitioned_map_unique_id_; | 6473 transitioned_map_ == instr->transitioned_map_; |
| 6527 } | 6474 } |
| 6528 | 6475 |
| 6529 private: | 6476 private: |
| 6530 HTransitionElementsKind(HValue* context, | 6477 HTransitionElementsKind(HValue* context, |
| 6531 HValue* object, | 6478 HValue* object, |
| 6532 Handle<Map> original_map, | 6479 Handle<Map> original_map, |
| 6533 Handle<Map> transitioned_map) | 6480 Handle<Map> transitioned_map) |
| 6534 : original_map_(original_map), | 6481 : original_map_(Unique<Map>(original_map)), |
| 6535 transitioned_map_(transitioned_map), | 6482 transitioned_map_(Unique<Map>(transitioned_map)), |
| 6536 original_map_unique_id_(), | |
| 6537 transitioned_map_unique_id_(), | |
| 6538 from_kind_(original_map->elements_kind()), | 6483 from_kind_(original_map->elements_kind()), |
| 6539 to_kind_(transitioned_map->elements_kind()) { | 6484 to_kind_(transitioned_map->elements_kind()) { |
| 6540 SetOperandAt(0, object); | 6485 SetOperandAt(0, object); |
| 6541 SetOperandAt(1, context); | 6486 SetOperandAt(1, context); |
| 6542 SetFlag(kUseGVN); | 6487 SetFlag(kUseGVN); |
| 6543 SetGVNFlag(kChangesElementsKind); | 6488 SetGVNFlag(kChangesElementsKind); |
| 6544 if (!IsSimpleMapChangeTransition(from_kind_, to_kind_)) { | 6489 if (!IsSimpleMapChangeTransition(from_kind_, to_kind_)) { |
| 6545 SetGVNFlag(kChangesElementsPointer); | 6490 SetGVNFlag(kChangesElementsPointer); |
| 6546 SetGVNFlag(kChangesNewSpacePromotion); | 6491 SetGVNFlag(kChangesNewSpacePromotion); |
| 6547 } | 6492 } |
| 6548 set_representation(Representation::Tagged()); | 6493 set_representation(Representation::Tagged()); |
| 6549 } | 6494 } |
| 6550 | 6495 |
| 6551 Handle<Map> original_map_; | 6496 Unique<Map> original_map_; |
| 6552 Handle<Map> transitioned_map_; | 6497 Unique<Map> transitioned_map_; |
| 6553 UniqueValueId original_map_unique_id_; | |
| 6554 UniqueValueId transitioned_map_unique_id_; | |
| 6555 ElementsKind from_kind_; | 6498 ElementsKind from_kind_; |
| 6556 ElementsKind to_kind_; | 6499 ElementsKind to_kind_; |
| 6557 }; | 6500 }; |
| 6558 | 6501 |
| 6559 | 6502 |
| 6560 class HStringAdd V8_FINAL : public HBinaryOperation { | 6503 class HStringAdd V8_FINAL : public HBinaryOperation { |
| 6561 public: | 6504 public: |
| 6562 static HInstruction* New(Zone* zone, | 6505 static HInstruction* New(Zone* zone, |
| 6563 HValue* context, | 6506 HValue* context, |
| 6564 HValue* left, | 6507 HValue* left, |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7063 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7006 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7064 }; | 7007 }; |
| 7065 | 7008 |
| 7066 | 7009 |
| 7067 #undef DECLARE_INSTRUCTION | 7010 #undef DECLARE_INSTRUCTION |
| 7068 #undef DECLARE_CONCRETE_INSTRUCTION | 7011 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7069 | 7012 |
| 7070 } } // namespace v8::internal | 7013 } } // namespace v8::internal |
| 7071 | 7014 |
| 7072 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7015 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |