| 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 cell->AddDependentCompilationInfo(top_info()); | 4928 cell->AddDependentCompilationInfo(top_info()); |
| 4929 Handle<Object> constant_object = cell->type()->AsConstant(); | 4929 Handle<Object> constant_object = cell->type()->AsConstant()->Value(); |
| 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(); | 5002 Handle<Map> map = type->AsClass()->Map(); |
| 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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5889 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( | 5889 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( |
| 5890 Variable* var, | 5890 Variable* var, |
| 5891 HValue* value, | 5891 HValue* value, |
| 5892 BailoutId ast_id) { | 5892 BailoutId ast_id) { |
| 5893 LookupResult lookup(isolate()); | 5893 LookupResult lookup(isolate()); |
| 5894 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, STORE); | 5894 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, STORE); |
| 5895 if (type == kUseCell) { | 5895 if (type == kUseCell) { |
| 5896 Handle<GlobalObject> global(current_info()->global_object()); | 5896 Handle<GlobalObject> global(current_info()->global_object()); |
| 5897 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup)); | 5897 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup)); |
| 5898 if (cell->type()->IsConstant()) { | 5898 if (cell->type()->IsConstant()) { |
| 5899 Handle<Object> constant = cell->type()->AsConstant(); | 5899 Handle<Object> constant = cell->type()->AsConstant()->Value(); |
| 5900 if (value->IsConstant()) { | 5900 if (value->IsConstant()) { |
| 5901 HConstant* c_value = HConstant::cast(value); | 5901 HConstant* c_value = HConstant::cast(value); |
| 5902 if (!constant.is_identical_to(c_value->handle(isolate()))) { | 5902 if (!constant.is_identical_to(c_value->handle(isolate()))) { |
| 5903 Add<HDeoptimize>("Constant global variable assignment", | 5903 Add<HDeoptimize>("Constant global variable assignment", |
| 5904 Deoptimizer::EAGER); | 5904 Deoptimizer::EAGER); |
| 5905 } | 5905 } |
| 5906 } else { | 5906 } else { |
| 5907 HValue* c_constant = Add<HConstant>(constant); | 5907 HValue* c_constant = Add<HConstant>(constant); |
| 5908 IfBuilder builder(this); | 5908 IfBuilder builder(this); |
| 5909 if (constant->IsNumber()) { | 5909 if (constant->IsNumber()) { |
| (...skipping 3906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9816 Representation left_rep = Representation::FromType(left_type); | 9816 Representation left_rep = Representation::FromType(left_type); |
| 9817 Representation right_rep = Representation::FromType(right_type); | 9817 Representation right_rep = Representation::FromType(right_type); |
| 9818 Representation combined_rep = Representation::FromType(combined_type); | 9818 Representation combined_rep = Representation::FromType(combined_type); |
| 9819 | 9819 |
| 9820 if (combined_type->Is(Type::Receiver())) { | 9820 if (combined_type->Is(Type::Receiver())) { |
| 9821 if (Token::IsEqualityOp(op)) { | 9821 if (Token::IsEqualityOp(op)) { |
| 9822 // Can we get away with map check and not instance type check? | 9822 // Can we get away with map check and not instance type check? |
| 9823 HValue* operand_to_check = | 9823 HValue* operand_to_check = |
| 9824 left->block()->block_id() < right->block()->block_id() ? left : right; | 9824 left->block()->block_id() < right->block()->block_id() ? left : right; |
| 9825 if (combined_type->IsClass()) { | 9825 if (combined_type->IsClass()) { |
| 9826 Handle<Map> map = combined_type->AsClass(); | 9826 Handle<Map> map = combined_type->AsClass()->Map(); |
| 9827 AddCheckMap(operand_to_check, map); | 9827 AddCheckMap(operand_to_check, map); |
| 9828 HCompareObjectEqAndBranch* result = | 9828 HCompareObjectEqAndBranch* result = |
| 9829 New<HCompareObjectEqAndBranch>(left, right); | 9829 New<HCompareObjectEqAndBranch>(left, right); |
| 9830 if (FLAG_hydrogen_track_positions) { | 9830 if (FLAG_hydrogen_track_positions) { |
| 9831 result->set_operand_position(zone(), 0, left_position); | 9831 result->set_operand_position(zone(), 0, left_position); |
| 9832 result->set_operand_position(zone(), 1, right_position); | 9832 result->set_operand_position(zone(), 1, right_position); |
| 9833 } | 9833 } |
| 9834 return result; | 9834 return result; |
| 9835 } else { | 9835 } else { |
| 9836 BuildCheckHeapObject(operand_to_check); | 9836 BuildCheckHeapObject(operand_to_check); |
| (...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11502 if (ShouldProduceTraceOutput()) { | 11502 if (ShouldProduceTraceOutput()) { |
| 11503 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11503 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 11504 } | 11504 } |
| 11505 | 11505 |
| 11506 #ifdef DEBUG | 11506 #ifdef DEBUG |
| 11507 graph_->Verify(false); // No full verify. | 11507 graph_->Verify(false); // No full verify. |
| 11508 #endif | 11508 #endif |
| 11509 } | 11509 } |
| 11510 | 11510 |
| 11511 } } // namespace v8::internal | 11511 } } // namespace v8::internal |
| OLD | NEW |