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

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

Issue 14040006: Remove relocation lock. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: changes to more HValues Created 7 years, 8 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-instructions.h ('k') | src/mark-compact.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 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 1577
1578 1578
1579 void HCheckMaps::SetSideEffectDominator(GVNFlag side_effect, 1579 void HCheckMaps::SetSideEffectDominator(GVNFlag side_effect,
1580 HValue* dominator) { 1580 HValue* dominator) {
1581 ASSERT(side_effect == kChangesMaps); 1581 ASSERT(side_effect == kChangesMaps);
1582 // TODO(mstarzinger): For now we specialize on HStoreNamedField, but once 1582 // TODO(mstarzinger): For now we specialize on HStoreNamedField, but once
1583 // type information is rich enough we should generalize this to any HType 1583 // type information is rich enough we should generalize this to any HType
1584 // for which the map is known. 1584 // for which the map is known.
1585 if (HasNoUses() && dominator->IsStoreNamedField()) { 1585 if (HasNoUses() && dominator->IsStoreNamedField()) {
1586 HStoreNamedField* store = HStoreNamedField::cast(dominator); 1586 HStoreNamedField* store = HStoreNamedField::cast(dominator);
1587 Handle<Map> map = store->transition(); 1587 Address map_address_ = store->transition_raw_address();
1588 if (map.is_null() || store->object() != value()) return; 1588 if (map_address_ == NULL || store->object() != value()) return;
1589 for (int i = 0; i < map_set()->length(); i++) { 1589 for (int i = 0; i < map_set()->length(); i++) {
1590 if (map.is_identical_to(map_set()->at(i))) { 1590 if (map_address_ == map_raw_addresses_.at(i)) {
1591 DeleteAndReplaceWith(NULL); 1591 DeleteAndReplaceWith(NULL);
1592 return; 1592 return;
1593 } 1593 }
1594 } 1594 }
1595 } 1595 }
1596 } 1596 }
1597 1597
1598 1598
1599 void HLoadElements::PrintDataTo(StringStream* stream) { 1599 void HLoadElements::PrintDataTo(StringStream* stream) {
1600 value()->PrintNameTo(stream); 1600 value()->PrintNameTo(stream);
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 double roundtrip_value = static_cast<double>(static_cast<int32_t>(value)); 2043 double roundtrip_value = static_cast<double>(static_cast<int32_t>(value));
2044 return BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(value); 2044 return BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(value);
2045 } 2045 }
2046 2046
2047 2047
2048 HConstant::HConstant(Handle<Object> handle, Representation r) 2048 HConstant::HConstant(Handle<Object> handle, Representation r)
2049 : handle_(handle), 2049 : handle_(handle),
2050 has_int32_value_(false), 2050 has_int32_value_(false),
2051 has_double_value_(false), 2051 has_double_value_(false),
2052 is_internalized_string_(false), 2052 is_internalized_string_(false),
2053 boolean_value_(handle->BooleanValue()) { 2053 boolean_value_(handle->BooleanValue()),
2054 raw_address_(NULL) {
2054 if (handle_->IsNumber()) { 2055 if (handle_->IsNumber()) {
2055 double n = handle_->Number(); 2056 double n = handle_->Number();
2056 has_int32_value_ = IsInteger32(n); 2057 has_int32_value_ = IsInteger32(n);
2057 int32_value_ = DoubleToInt32(n); 2058 int32_value_ = DoubleToInt32(n);
2058 double_value_ = n; 2059 double_value_ = n;
2059 has_double_value_ = true; 2060 has_double_value_ = true;
2060 } else { 2061 } else {
2061 type_from_value_ = HType::TypeFromValue(handle_); 2062 type_from_value_ = HType::TypeFromValue(handle_);
2062 is_internalized_string_ = handle_->IsInternalizedString(); 2063 is_internalized_string_ = handle_->IsInternalizedString();
2063 } 2064 }
2064 if (r.IsNone()) { 2065 if (r.IsNone()) {
2065 if (has_int32_value_) { 2066 if (has_int32_value_) {
2066 r = Representation::Integer32(); 2067 r = Representation::Integer32();
2067 } else if (has_double_value_) { 2068 } else if (has_double_value_) {
2068 r = Representation::Double(); 2069 r = Representation::Double();
2069 } else { 2070 } else {
2070 r = Representation::Tagged(); 2071 r = Representation::Tagged();
2071 } 2072 }
2072 } 2073 }
2073 Initialize(r); 2074 Initialize(r);
2074 } 2075 }
2075 2076
2076 2077
2077 HConstant::HConstant(Handle<Object> handle, 2078 HConstant::HConstant(Handle<Object> handle,
2079 Address raw_address,
2078 Representation r, 2080 Representation r,
2079 HType type, 2081 HType type,
2080 bool is_internalize_string, 2082 bool is_internalize_string,
2081 bool boolean_value) 2083 bool boolean_value)
2082 : handle_(handle), 2084 : handle_(handle),
2083 has_int32_value_(false), 2085 has_int32_value_(false),
2084 has_double_value_(false), 2086 has_double_value_(false),
2085 is_internalized_string_(is_internalize_string), 2087 is_internalized_string_(is_internalize_string),
2086 boolean_value_(boolean_value), 2088 boolean_value_(boolean_value),
2089 raw_address_(raw_address),
2087 type_from_value_(type) { 2090 type_from_value_(type) {
2088 ASSERT(!handle.is_null()); 2091 ASSERT(!handle.is_null());
2089 ASSERT(!type.IsUninitialized()); 2092 ASSERT(!type.IsUninitialized());
2090 ASSERT(!type.IsTaggedNumber()); 2093 ASSERT(!type.IsTaggedNumber());
2091 Initialize(r); 2094 Initialize(r);
2092 } 2095 }
2093 2096
2094 2097
2095 HConstant::HConstant(int32_t integer_value, 2098 HConstant::HConstant(int32_t integer_value,
2096 Representation r, 2099 Representation r,
2097 Handle<Object> optional_handle) 2100 Handle<Object> optional_handle)
2098 : has_int32_value_(true), 2101 : handle_(optional_handle),
2102 has_int32_value_(true),
2099 has_double_value_(true), 2103 has_double_value_(true),
2100 is_internalized_string_(false), 2104 is_internalized_string_(false),
2101 boolean_value_(integer_value != 0), 2105 boolean_value_(integer_value != 0),
2102 int32_value_(integer_value), 2106 int32_value_(integer_value),
2103 double_value_(FastI2D(integer_value)) { 2107 double_value_(FastI2D(integer_value)) {
2104 Initialize(r); 2108 Initialize(r);
2105 } 2109 }
2106 2110
2107 2111
2108 HConstant::HConstant(double double_value, 2112 HConstant::HConstant(double double_value,
2109 Representation r, 2113 Representation r,
2110 Handle<Object> optional_handle) 2114 Handle<Object> optional_handle)
2111 : has_int32_value_(IsInteger32(double_value)), 2115 : handle_(optional_handle),
2116 has_int32_value_(IsInteger32(double_value)),
2112 has_double_value_(true), 2117 has_double_value_(true),
2113 is_internalized_string_(false), 2118 is_internalized_string_(false),
2114 boolean_value_(double_value != 0 && !isnan(double_value)), 2119 boolean_value_(double_value != 0 && !isnan(double_value)),
2115 int32_value_(DoubleToInt32(double_value)), 2120 int32_value_(DoubleToInt32(double_value)),
2116 double_value_(double_value) { 2121 double_value_(double_value) {
2117 Initialize(r); 2122 Initialize(r);
2118 } 2123 }
2119 2124
2120 2125
2121 void HConstant::Initialize(Representation r) { 2126 void HConstant::Initialize(Representation r) {
2122 set_representation(r); 2127 set_representation(r);
2123 SetFlag(kUseGVN); 2128 SetFlag(kUseGVN);
2124 if (representation().IsInteger32()) { 2129 if (representation().IsInteger32()) {
2125 ClearGVNFlag(kDependsOnOsrEntries); 2130 ClearGVNFlag(kDependsOnOsrEntries);
2126 } 2131 }
2127 } 2132 }
2128 2133
2129 2134
2130 HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const { 2135 HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const {
2131 if (r.IsInteger32() && !has_int32_value_) return NULL; 2136 if (r.IsInteger32() && !has_int32_value_) return NULL;
2132 if (r.IsDouble() && !has_double_value_) return NULL; 2137 if (r.IsDouble() && !has_double_value_) return NULL;
2133 if (has_int32_value_) return new(zone) HConstant(int32_value_, r, handle_); 2138 if (has_int32_value_) return new(zone) HConstant(int32_value_, r, handle_);
2134 if (has_double_value_) return new(zone) HConstant(double_value_, r, handle_); 2139 if (has_double_value_) return new(zone) HConstant(double_value_, r, handle_);
2135 ASSERT(!handle_.is_null()); 2140 ASSERT(!handle_.is_null());
2136 return new(zone) HConstant( 2141 ASSERT_NE(NULL, raw_address_);
2137 handle_, r, type_from_value_, is_internalized_string_, boolean_value_); 2142 return new(zone) HConstant(handle_,
2143 raw_address_,
2144 r,
2145 type_from_value_,
2146 is_internalized_string_,
2147 boolean_value_);
2138 } 2148 }
2139 2149
2140 2150
2141 HConstant* HConstant::CopyToTruncatedInt32(Zone* zone) const { 2151 HConstant* HConstant::CopyToTruncatedInt32(Zone* zone) const {
2142 if (has_int32_value_) { 2152 if (has_int32_value_) {
2143 return new(zone) HConstant( 2153 return new(zone) HConstant(
2144 int32_value_, Representation::Integer32(), handle_); 2154 int32_value_, Representation::Integer32(), handle_);
2145 } 2155 }
2146 if (has_double_value_) { 2156 if (has_double_value_) {
2147 return new(zone) HConstant( 2157 return new(zone) HConstant(
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
2452 } 2462 }
2453 2463
2454 2464
2455 HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context, 2465 HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context,
2456 HValue* object, 2466 HValue* object,
2457 SmallMapList* types, 2467 SmallMapList* types,
2458 Handle<String> name, 2468 Handle<String> name,
2459 Zone* zone) 2469 Zone* zone)
2460 : types_(Min(types->length(), kMaxLoadPolymorphism), zone), 2470 : types_(Min(types->length(), kMaxLoadPolymorphism), zone),
2461 name_(name), 2471 name_(name),
2472 types_raw_address_(0, zone),
2473 name_raw_address_(NULL),
2462 need_generic_(false) { 2474 need_generic_(false) {
2463 SetOperandAt(0, context); 2475 SetOperandAt(0, context);
2464 SetOperandAt(1, object); 2476 SetOperandAt(1, object);
2465 set_representation(Representation::Tagged()); 2477 set_representation(Representation::Tagged());
2466 SetGVNFlag(kDependsOnMaps); 2478 SetGVNFlag(kDependsOnMaps);
2467 SmallMapList negative_lookups; 2479 SmallMapList negative_lookups;
2468 for (int i = 0; 2480 for (int i = 0;
2469 i < types->length() && types_.length() < kMaxLoadPolymorphism; 2481 i < types->length() && types_.length() < kMaxLoadPolymorphism;
2470 ++i) { 2482 ++i) {
2471 Handle<Map> map = types->at(i); 2483 Handle<Map> map = types->at(i);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2518 // We don't have an easy way to handle both a call (to the generic stub) and 2530 // We don't have an easy way to handle both a call (to the generic stub) and
2519 // a deopt in the same hydrogen instruction, so in this case we don't add 2531 // a deopt in the same hydrogen instruction, so in this case we don't add
2520 // the negative lookups which can deopt - just let the generic stub handle 2532 // the negative lookups which can deopt - just let the generic stub handle
2521 // them. 2533 // them.
2522 SetAllSideEffects(); 2534 SetAllSideEffects();
2523 need_generic_ = true; 2535 need_generic_ = true;
2524 } 2536 }
2525 } 2537 }
2526 2538
2527 2539
2540 void HCheckMaps::FinalizeUniqueId() {
2541 // Raw addresses may have already been collected.
Sven Panne 2013/04/16 06:43:44 I don't understand this comment here and elsewhere
2542 if (map_raw_addresses_.is_empty()) {
2543 Zone* zone = block()->zone();
2544 map_raw_addresses_.Initialize(map_set_.length(), zone);
2545 for (int i = 0; i < map_set_.length(); i++) {
2546 map_raw_addresses_.Add(
2547 reinterpret_cast<Address>(*map_set_.at(i)), zone);
2548 }
2549 }
2550 ASSERT_EQ(map_set_.length(), map_raw_addresses_.length());
2551 }
2552
2553
2554 void HLoadNamedFieldPolymorphic::FinalizeUniqueId() {
2555 // Raw addresses may have already been collected.
2556 if (types_raw_address_.is_empty()) {
2557 Zone* zone = block()->zone();
2558 types_raw_address_.Initialize(types_.length(), zone);
2559 for (int i = 0; i < types_.length(); i++) {
2560 types_raw_address_.Add(reinterpret_cast<Address>(*types_.at(i)), zone);
2561 }
2562 }
2563 ASSERT_EQ(types_.length(), types_raw_address_.length());
2564 ASSERT(name_raw_address_ == NULL ||
2565 name_raw_address_ == reinterpret_cast<Address>(*name_));
2566 name_raw_address_ = reinterpret_cast<Address>(*name_);
2567 }
2568
2569
2528 bool HLoadNamedFieldPolymorphic::DataEquals(HValue* value) { 2570 bool HLoadNamedFieldPolymorphic::DataEquals(HValue* value) {
2571 ASSERT_EQ(types_.length(), types_raw_address_.length());
2572 ASSERT_NE(NULL, name_raw_address_);
2529 HLoadNamedFieldPolymorphic* other = HLoadNamedFieldPolymorphic::cast(value); 2573 HLoadNamedFieldPolymorphic* other = HLoadNamedFieldPolymorphic::cast(value);
2530 if (types_.length() != other->types()->length()) return false; 2574 if (types_raw_address_.length() != other->types_raw_address_.length()) {
2531 if (!name_.is_identical_to(other->name())) return false; 2575 return false;
2576 }
2577 if (name_raw_address_ != name_raw_address_) return false;
2532 if (need_generic_ != other->need_generic_) return false; 2578 if (need_generic_ != other->need_generic_) return false;
2533 for (int i = 0; i < types_.length(); i++) { 2579 for (int i = 0; i < types_raw_address_.length(); i++) {
2534 bool found = false; 2580 bool found = false;
2535 for (int j = 0; j < types_.length(); j++) { 2581 for (int j = 0; j < types_raw_address_.length(); j++) {
2536 if (types_.at(j).is_identical_to(other->types()->at(i))) { 2582 if (types_raw_address_.at(j) == other->types_raw_address_.at(i)) {
2537 found = true; 2583 found = true;
2538 break; 2584 break;
2539 } 2585 }
2540 } 2586 }
2541 if (!found) return false; 2587 if (!found) return false;
2542 } 2588 }
2543 return true; 2589 return true;
2544 } 2590 }
2545 2591
2546 2592
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
3533 3579
3534 3580
3535 void HCheckFunction::Verify() { 3581 void HCheckFunction::Verify() {
3536 HInstruction::Verify(); 3582 HInstruction::Verify();
3537 ASSERT(HasNoUses()); 3583 ASSERT(HasNoUses());
3538 } 3584 }
3539 3585
3540 #endif 3586 #endif
3541 3587
3542 } } // namespace v8::internal 3588 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698