OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 4907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4918 | 4918 |
4919 if (type == kUseCell && | 4919 if (type == kUseCell && |
4920 current_info()->global_object()->IsAccessCheckNeeded()) { | 4920 current_info()->global_object()->IsAccessCheckNeeded()) { |
4921 type = kUseGeneric; | 4921 type = kUseGeneric; |
4922 } | 4922 } |
4923 | 4923 |
4924 if (type == kUseCell) { | 4924 if (type == kUseCell) { |
4925 Handle<GlobalObject> global(current_info()->global_object()); | 4925 Handle<GlobalObject> global(current_info()->global_object()); |
4926 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup)); | 4926 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup)); |
4927 if (cell->type()->IsConstant()) { | 4927 if (cell->type()->IsConstant()) { |
4928 cell->AddDependentCompilationInfo(top_info()); | 4928 PropertyCell::AddDependentCompilationInfo(cell, top_info()); |
4929 Handle<Object> constant_object = cell->type()->AsConstant(); | 4929 Handle<Object> constant_object = cell->type()->AsConstant(); |
4930 if (constant_object->IsConsString()) { | 4930 if (constant_object->IsConsString()) { |
4931 constant_object = | 4931 constant_object = |
4932 String::Flatten(Handle<String>::cast(constant_object)); | 4932 String::Flatten(Handle<String>::cast(constant_object)); |
4933 } | 4933 } |
4934 HConstant* constant = New<HConstant>(constant_object); | 4934 HConstant* constant = New<HConstant>(constant_object); |
4935 return ast_context()->ReturnInstruction(constant, expr->id()); | 4935 return ast_context()->ReturnInstruction(constant, expr->id()); |
4936 } else { | 4936 } else { |
4937 HLoadGlobalCell* instr = | 4937 HLoadGlobalCell* instr = |
4938 New<HLoadGlobalCell>(cell, lookup.GetPropertyDetails()); | 4938 New<HLoadGlobalCell>(cell, lookup.GetPropertyDetails()); |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5545 } | 5545 } |
5546 | 5546 |
5547 | 5547 |
5548 void HOptimizedGraphBuilder::PropertyAccessInfo::LoadFieldMap(Handle<Map> map) { | 5548 void HOptimizedGraphBuilder::PropertyAccessInfo::LoadFieldMap(Handle<Map> map) { |
5549 // Figure out the field type from the accessor map. | 5549 // Figure out the field type from the accessor map. |
5550 HeapType* field_type = lookup_.GetFieldTypeFromMap(*map); | 5550 HeapType* field_type = lookup_.GetFieldTypeFromMap(*map); |
5551 if (field_type->IsClass()) { | 5551 if (field_type->IsClass()) { |
5552 Handle<Map> field_map = field_type->AsClass(); | 5552 Handle<Map> field_map = field_type->AsClass(); |
5553 if (field_map->is_stable()) { | 5553 if (field_map->is_stable()) { |
5554 field_map_ = field_map; | 5554 field_map_ = field_map; |
5555 field_map_->AddDependentCompilationInfo( | 5555 Map::AddDependentCompilationInfo( |
5556 DependentCode::kPrototypeCheckGroup, top_info()); | 5556 field_map_, DependentCode::kPrototypeCheckGroup, top_info()); |
5557 | 5557 |
5558 // Add dependency on the map that introduced the field. | 5558 // Add dependency on the map that introduced the field. |
5559 lookup_.GetFieldOwnerFromMap(*map)->AddDependentCompilationInfo( | 5559 Map::AddDependentCompilationInfo( |
| 5560 handle(lookup_.GetFieldOwnerFromMap(*map), isolate()), |
5560 DependentCode::kFieldTypeGroup, top_info()); | 5561 DependentCode::kFieldTypeGroup, top_info()); |
5561 } | 5562 } |
5562 } | 5563 } |
5563 } | 5564 } |
5564 | 5565 |
5565 | 5566 |
5566 bool HOptimizedGraphBuilder::PropertyAccessInfo::LookupInPrototypes() { | 5567 bool HOptimizedGraphBuilder::PropertyAccessInfo::LookupInPrototypes() { |
5567 Handle<Map> map = this->map(); | 5568 Handle<Map> map = this->map(); |
5568 | 5569 |
5569 while (map->prototype()->IsJSObject()) { | 5570 while (map->prototype()->IsJSObject()) { |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6819 CHECK_ALIVE(VisitForValue(expr->key())); | 6820 CHECK_ALIVE(VisitForValue(expr->key())); |
6820 } | 6821 } |
6821 | 6822 |
6822 BuildLoad(expr, expr->id()); | 6823 BuildLoad(expr, expr->id()); |
6823 } | 6824 } |
6824 | 6825 |
6825 | 6826 |
6826 HInstruction* HGraphBuilder::BuildConstantMapCheck(Handle<JSObject> constant, | 6827 HInstruction* HGraphBuilder::BuildConstantMapCheck(Handle<JSObject> constant, |
6827 CompilationInfo* info) { | 6828 CompilationInfo* info) { |
6828 HConstant* constant_value = New<HConstant>(constant); | 6829 HConstant* constant_value = New<HConstant>(constant); |
| 6830 Handle<Map> map(constant->map(), info->isolate()); |
6829 | 6831 |
6830 if (constant->map()->CanOmitMapChecks()) { | 6832 if (constant->map()->CanOmitMapChecks()) { |
6831 constant->map()->AddDependentCompilationInfo( | 6833 Map::AddDependentCompilationInfo( |
6832 DependentCode::kPrototypeCheckGroup, info); | 6834 map, DependentCode::kPrototypeCheckGroup, info); |
6833 return constant_value; | 6835 return constant_value; |
6834 } | 6836 } |
6835 | 6837 |
6836 AddInstruction(constant_value); | 6838 AddInstruction(constant_value); |
6837 HCheckMaps* check = | 6839 HCheckMaps* check = Add<HCheckMaps>(constant_value, map, info); |
6838 Add<HCheckMaps>(constant_value, handle(constant->map()), info); | |
6839 check->ClearDependsOnFlag(kElementsKind); | 6840 check->ClearDependsOnFlag(kElementsKind); |
6840 return check; | 6841 return check; |
6841 } | 6842 } |
6842 | 6843 |
6843 | 6844 |
6844 HInstruction* HGraphBuilder::BuildCheckPrototypeMaps(Handle<JSObject> prototype, | 6845 HInstruction* HGraphBuilder::BuildCheckPrototypeMaps(Handle<JSObject> prototype, |
6845 Handle<JSObject> holder) { | 6846 Handle<JSObject> holder) { |
6846 while (holder.is_null() || !prototype.is_identical_to(holder)) { | 6847 while (holder.is_null() || !prototype.is_identical_to(holder)) { |
6847 BuildConstantMapCheck(prototype, top_info()); | 6848 BuildConstantMapCheck(prototype, top_info()); |
6848 Object* next_prototype = prototype->GetPrototype(); | 6849 Object* next_prototype = prototype->GetPrototype(); |
(...skipping 4751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11600 if (ShouldProduceTraceOutput()) { | 11601 if (ShouldProduceTraceOutput()) { |
11601 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11602 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11602 } | 11603 } |
11603 | 11604 |
11604 #ifdef DEBUG | 11605 #ifdef DEBUG |
11605 graph_->Verify(false); // No full verify. | 11606 graph_->Verify(false); // No full verify. |
11606 #endif | 11607 #endif |
11607 } | 11608 } |
11608 | 11609 |
11609 } } // namespace v8::internal | 11610 } } // namespace v8::internal |
OLD | NEW |