| 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 4908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 PropertyCell::AddDependentCompilationInfo(cell, top_info()); | 4928 PropertyCell::AddDependentCompilationInfo(cell, top_info()); |
| 4929 Handle<Object> constant_object = cell->type()->AsConstant()->Value(); | 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()); |
| 4939 return ast_context()->ReturnInstruction(instr, expr->id()); | 4939 return ast_context()->ReturnInstruction(instr, expr->id()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4992 expr->pattern(), | 4992 expr->pattern(), |
| 4993 expr->flags(), | 4993 expr->flags(), |
| 4994 expr->literal_index()); | 4994 expr->literal_index()); |
| 4995 return ast_context()->ReturnInstruction(instr, expr->id()); | 4995 return ast_context()->ReturnInstruction(instr, expr->id()); |
| 4996 } | 4996 } |
| 4997 | 4997 |
| 4998 | 4998 |
| 4999 static bool CanInlinePropertyAccess(Type* type) { | 4999 static bool CanInlinePropertyAccess(Type* type) { |
| 5000 if (type->Is(Type::NumberOrString())) return true; | 5000 if (type->Is(Type::NumberOrString())) return true; |
| 5001 if (!type->IsClass()) return false; | 5001 if (!type->IsClass()) return false; |
| 5002 Handle<Map> map = type->AsClass()->Map(); | 5002 Handle<Map> map = type->AsClass(); |
| 5003 return map->IsJSObjectMap() && | 5003 return map->IsJSObjectMap() && |
| 5004 !map->is_dictionary_map() && | 5004 !map->is_dictionary_map() && |
| 5005 !map->has_named_interceptor(); | 5005 !map->has_named_interceptor(); |
| 5006 } | 5006 } |
| 5007 | 5007 |
| 5008 | 5008 |
| 5009 // Determines whether the given array or object literal boilerplate satisfies | 5009 // Determines whether the given array or object literal boilerplate satisfies |
| 5010 // all limits to be considered for fast deep-copying and computes the total | 5010 // all limits to be considered for fast deep-copying and computes the total |
| 5011 // size of all objects that are part of the graph. | 5011 // size of all objects that are part of the graph. |
| 5012 static bool IsFastLiteral(Handle<JSObject> boilerplate, | 5012 static bool IsFastLiteral(Handle<JSObject> boilerplate, |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5984 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( | 5984 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( |
| 5985 Variable* var, | 5985 Variable* var, |
| 5986 HValue* value, | 5986 HValue* value, |
| 5987 BailoutId ast_id) { | 5987 BailoutId ast_id) { |
| 5988 LookupResult lookup(isolate()); | 5988 LookupResult lookup(isolate()); |
| 5989 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, STORE); | 5989 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, STORE); |
| 5990 if (type == kUseCell) { | 5990 if (type == kUseCell) { |
| 5991 Handle<GlobalObject> global(current_info()->global_object()); | 5991 Handle<GlobalObject> global(current_info()->global_object()); |
| 5992 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup)); | 5992 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup)); |
| 5993 if (cell->type()->IsConstant()) { | 5993 if (cell->type()->IsConstant()) { |
| 5994 Handle<Object> constant = cell->type()->AsConstant()->Value(); | 5994 Handle<Object> constant = cell->type()->AsConstant(); |
| 5995 if (value->IsConstant()) { | 5995 if (value->IsConstant()) { |
| 5996 HConstant* c_value = HConstant::cast(value); | 5996 HConstant* c_value = HConstant::cast(value); |
| 5997 if (!constant.is_identical_to(c_value->handle(isolate()))) { | 5997 if (!constant.is_identical_to(c_value->handle(isolate()))) { |
| 5998 Add<HDeoptimize>("Constant global variable assignment", | 5998 Add<HDeoptimize>("Constant global variable assignment", |
| 5999 Deoptimizer::EAGER); | 5999 Deoptimizer::EAGER); |
| 6000 } | 6000 } |
| 6001 } else { | 6001 } else { |
| 6002 HValue* c_constant = Add<HConstant>(constant); | 6002 HValue* c_constant = Add<HConstant>(constant); |
| 6003 IfBuilder builder(this); | 6003 IfBuilder builder(this); |
| 6004 if (constant->IsNumber()) { | 6004 if (constant->IsNumber()) { |
| (...skipping 3931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9936 HConstant::cast(right)->HasNumberValue())) { | 9936 HConstant::cast(right)->HasNumberValue())) { |
| 9937 Add<HDeoptimize>("Type mismatch between feedback and constant", | 9937 Add<HDeoptimize>("Type mismatch between feedback and constant", |
| 9938 Deoptimizer::SOFT); | 9938 Deoptimizer::SOFT); |
| 9939 // The caller expects a branch instruction, so make it happy. | 9939 // The caller expects a branch instruction, so make it happy. |
| 9940 return New<HBranch>(graph()->GetConstantTrue()); | 9940 return New<HBranch>(graph()->GetConstantTrue()); |
| 9941 } | 9941 } |
| 9942 // Can we get away with map check and not instance type check? | 9942 // Can we get away with map check and not instance type check? |
| 9943 HValue* operand_to_check = | 9943 HValue* operand_to_check = |
| 9944 left->block()->block_id() < right->block()->block_id() ? left : right; | 9944 left->block()->block_id() < right->block()->block_id() ? left : right; |
| 9945 if (combined_type->IsClass()) { | 9945 if (combined_type->IsClass()) { |
| 9946 Handle<Map> map = combined_type->AsClass()->Map(); | 9946 Handle<Map> map = combined_type->AsClass(); |
| 9947 AddCheckMap(operand_to_check, map); | 9947 AddCheckMap(operand_to_check, map); |
| 9948 HCompareObjectEqAndBranch* result = | 9948 HCompareObjectEqAndBranch* result = |
| 9949 New<HCompareObjectEqAndBranch>(left, right); | 9949 New<HCompareObjectEqAndBranch>(left, right); |
| 9950 if (FLAG_hydrogen_track_positions) { | 9950 if (FLAG_hydrogen_track_positions) { |
| 9951 result->set_operand_position(zone(), 0, left_position); | 9951 result->set_operand_position(zone(), 0, left_position); |
| 9952 result->set_operand_position(zone(), 1, right_position); | 9952 result->set_operand_position(zone(), 1, right_position); |
| 9953 } | 9953 } |
| 9954 return result; | 9954 return result; |
| 9955 } else { | 9955 } else { |
| 9956 BuildCheckHeapObject(operand_to_check); | 9956 BuildCheckHeapObject(operand_to_check); |
| (...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11633 if (ShouldProduceTraceOutput()) { | 11633 if (ShouldProduceTraceOutput()) { |
| 11634 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11634 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 11635 } | 11635 } |
| 11636 | 11636 |
| 11637 #ifdef DEBUG | 11637 #ifdef DEBUG |
| 11638 graph_->Verify(false); // No full verify. | 11638 graph_->Verify(false); // No full verify. |
| 11639 #endif | 11639 #endif |
| 11640 } | 11640 } |
| 11641 | 11641 |
| 11642 } } // namespace v8::internal | 11642 } } // namespace v8::internal |
| OLD | NEW |