| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 6739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6750 HCheckMaps* checked_object = Add<HCheckMaps>(object, map, dependency); | 6750 HCheckMaps* checked_object = Add<HCheckMaps>(object, map, dependency); |
| 6751 if (dependency) { | 6751 if (dependency) { |
| 6752 checked_object->ClearDependsOnFlag(kElementsKind); | 6752 checked_object->ClearDependsOnFlag(kElementsKind); |
| 6753 } | 6753 } |
| 6754 | 6754 |
| 6755 if (access_type == STORE && map->prototype()->IsJSObject()) { | 6755 if (access_type == STORE && map->prototype()->IsJSObject()) { |
| 6756 // monomorphic stores need a prototype chain check because shape | 6756 // monomorphic stores need a prototype chain check because shape |
| 6757 // changes could allow callbacks on elements in the chain that | 6757 // changes could allow callbacks on elements in the chain that |
| 6758 // aren't compatible with monomorphic keyed stores. | 6758 // aren't compatible with monomorphic keyed stores. |
| 6759 Handle<JSObject> prototype(JSObject::cast(map->prototype())); | 6759 Handle<JSObject> prototype(JSObject::cast(map->prototype())); |
| 6760 JSObject* holder = JSObject::cast(map->prototype()); | 6760 JSObject* holder = NULL; |
| 6761 while (!holder->GetPrototype()->IsNull()) { | 6761 for (PrototypeIterator<STORE_AS_POINTER, MAP_BASED_WALK, END_AT_NULL_VALUE> |
| 6762 holder = JSObject::cast(holder->GetPrototype()); | 6762 iter(*prototype); !iter.IsAtEnd(); iter.Advance()) { |
| 6763 holder = JSObject::cast(iter.GetCurrent()); |
| 6763 } | 6764 } |
| 6764 | 6765 |
| 6765 BuildCheckPrototypeMaps(prototype, | 6766 BuildCheckPrototypeMaps(prototype, |
| 6766 Handle<JSObject>(JSObject::cast(holder))); | 6767 Handle<JSObject>(JSObject::cast(holder))); |
| 6767 } | 6768 } |
| 6768 | 6769 |
| 6769 LoadKeyedHoleMode load_mode = BuildKeyedHoleMode(map); | 6770 LoadKeyedHoleMode load_mode = BuildKeyedHoleMode(map); |
| 6770 return BuildUncheckedMonomorphicElementAccess( | 6771 return BuildUncheckedMonomorphicElementAccess( |
| 6771 checked_object, key, val, | 6772 checked_object, key, val, |
| 6772 map->instance_type() == JS_ARRAY_TYPE, | 6773 map->instance_type() == JS_ARRAY_TYPE, |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7230 Add<HConstant>(constant), handle(constant->map())); | 7231 Add<HConstant>(constant), handle(constant->map())); |
| 7231 check->ClearDependsOnFlag(kElementsKind); | 7232 check->ClearDependsOnFlag(kElementsKind); |
| 7232 return check; | 7233 return check; |
| 7233 } | 7234 } |
| 7234 | 7235 |
| 7235 | 7236 |
| 7236 HInstruction* HGraphBuilder::BuildCheckPrototypeMaps(Handle<JSObject> prototype, | 7237 HInstruction* HGraphBuilder::BuildCheckPrototypeMaps(Handle<JSObject> prototype, |
| 7237 Handle<JSObject> holder) { | 7238 Handle<JSObject> holder) { |
| 7238 while (holder.is_null() || !prototype.is_identical_to(holder)) { | 7239 while (holder.is_null() || !prototype.is_identical_to(holder)) { |
| 7239 BuildConstantMapCheck(prototype); | 7240 BuildConstantMapCheck(prototype); |
| 7240 Object* next_prototype = prototype->GetPrototype(); | 7241 Object* next_prototype = SAFE_GET_PROTOTYPE_FAST(*prototype); |
| 7241 if (next_prototype->IsNull()) return NULL; | 7242 if (next_prototype->IsNull()) return NULL; |
| 7242 CHECK(next_prototype->IsJSObject()); | 7243 CHECK(next_prototype->IsJSObject()); |
| 7243 prototype = handle(JSObject::cast(next_prototype)); | 7244 prototype = handle(JSObject::cast(next_prototype)); |
| 7244 } | 7245 } |
| 7245 return BuildConstantMapCheck(prototype); | 7246 return BuildConstantMapCheck(prototype); |
| 7246 } | 7247 } |
| 7247 | 7248 |
| 7248 | 7249 |
| 7249 void HOptimizedGraphBuilder::AddCheckPrototypeMaps(Handle<JSObject> holder, | 7250 void HOptimizedGraphBuilder::AddCheckPrototypeMaps(Handle<JSObject> holder, |
| 7250 Handle<Map> receiver_map) { | 7251 Handle<Map> receiver_map) { |
| (...skipping 5098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12349 if (ShouldProduceTraceOutput()) { | 12350 if (ShouldProduceTraceOutput()) { |
| 12350 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12351 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 12351 } | 12352 } |
| 12352 | 12353 |
| 12353 #ifdef DEBUG | 12354 #ifdef DEBUG |
| 12354 graph_->Verify(false); // No full verify. | 12355 graph_->Verify(false); // No full verify. |
| 12355 #endif | 12356 #endif |
| 12356 } | 12357 } |
| 12357 | 12358 |
| 12358 } } // namespace v8::internal | 12359 } } // namespace v8::internal |
| OLD | NEW |