OLD | NEW |
---|---|
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 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1947 | 1947 |
1948 | 1948 |
1949 HStoreNamedField* HGraphBuilder::AddStoreMapConstant(HValue *object, | 1949 HStoreNamedField* HGraphBuilder::AddStoreMapConstant(HValue *object, |
1950 Handle<Map> map) { | 1950 Handle<Map> map) { |
1951 return Add<HStoreNamedField>(object, HObjectAccess::ForMap(), | 1951 return Add<HStoreNamedField>(object, HObjectAccess::ForMap(), |
1952 Add<HConstant>(map)); | 1952 Add<HConstant>(map)); |
1953 } | 1953 } |
1954 | 1954 |
1955 | 1955 |
1956 HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin, | 1956 HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin, |
1957 HContext* context) { | 1957 HValue* context) { |
1958 HGlobalObject* global_object = Add<HGlobalObject>(context); | 1958 HGlobalObject* global_object = Add<HGlobalObject>(context); |
1959 HObjectAccess access = HObjectAccess::ForJSObjectOffset( | 1959 HObjectAccess access = HObjectAccess::ForJSObjectOffset( |
1960 GlobalObject::kBuiltinsOffset); | 1960 GlobalObject::kBuiltinsOffset); |
1961 HValue* builtins = AddLoad(global_object, access); | 1961 HValue* builtins = AddLoad(global_object, access); |
1962 HObjectAccess function_access = HObjectAccess::ForJSObjectOffset( | 1962 HObjectAccess function_access = HObjectAccess::ForJSObjectOffset( |
1963 JSBuiltinsObject::OffsetOfFunctionWithId(builtin)); | 1963 JSBuiltinsObject::OffsetOfFunctionWithId(builtin)); |
1964 return AddLoad(builtins, function_access); | 1964 return AddLoad(builtins, function_access); |
1965 } | 1965 } |
1966 | 1966 |
1967 | 1967 |
(...skipping 6318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8286 | 8286 |
8287 void HOptimizedGraphBuilder::VisitDelete(UnaryOperation* expr) { | 8287 void HOptimizedGraphBuilder::VisitDelete(UnaryOperation* expr) { |
8288 Property* prop = expr->expression()->AsProperty(); | 8288 Property* prop = expr->expression()->AsProperty(); |
8289 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 8289 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
8290 if (prop != NULL) { | 8290 if (prop != NULL) { |
8291 CHECK_ALIVE(VisitForValue(prop->obj())); | 8291 CHECK_ALIVE(VisitForValue(prop->obj())); |
8292 CHECK_ALIVE(VisitForValue(prop->key())); | 8292 CHECK_ALIVE(VisitForValue(prop->key())); |
8293 HValue* key = Pop(); | 8293 HValue* key = Pop(); |
8294 HValue* obj = Pop(); | 8294 HValue* obj = Pop(); |
8295 HValue* context = environment()->LookupContext(); | 8295 HValue* context = environment()->LookupContext(); |
8296 HDeleteProperty* instr = new(zone()) HDeleteProperty(context, obj, key); | 8296 HValue* function = AddLoadJSBuiltin(Builtins::DELETE, context); |
8297 Add<HPushArgument>(obj); | |
8298 Add<HPushArgument>(key); | |
8299 Add<HPushArgument>(Add<HConstant>(function_strict_mode_flag())); | |
8300 HInstruction* instr = new(zone()) HInvokeFunction(context, function, 3); | |
Michael Starzinger
2013/07/05 13:47:49
This will introduce an additional check that compa
| |
8297 return ast_context()->ReturnInstruction(instr, expr->id()); | 8301 return ast_context()->ReturnInstruction(instr, expr->id()); |
8298 } else if (proxy != NULL) { | 8302 } else if (proxy != NULL) { |
8299 Variable* var = proxy->var(); | 8303 Variable* var = proxy->var(); |
8300 if (var->IsUnallocated()) { | 8304 if (var->IsUnallocated()) { |
8301 Bailout("delete with global variable"); | 8305 Bailout("delete with global variable"); |
8302 } else if (var->IsStackAllocated() || var->IsContextSlot()) { | 8306 } else if (var->IsStackAllocated() || var->IsContextSlot()) { |
8303 // Result of deleting non-global variables is false. 'this' is not | 8307 // Result of deleting non-global variables is false. 'this' is not |
8304 // really a variable, though we implement it as one. The | 8308 // really a variable, though we implement it as one. The |
8305 // subexpression does not have side effects. | 8309 // subexpression does not have side effects. |
8306 HValue* value = var->is_this() | 8310 HValue* value = var->is_this() |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9098 Add<HCheckFunction>(right, target); | 9102 Add<HCheckFunction>(right, target); |
9099 HInstanceOfKnownGlobal* result = | 9103 HInstanceOfKnownGlobal* result = |
9100 new(zone()) HInstanceOfKnownGlobal(context, left, target); | 9104 new(zone()) HInstanceOfKnownGlobal(context, left, target); |
9101 result->set_position(expr->position()); | 9105 result->set_position(expr->position()); |
9102 return ast_context()->ReturnInstruction(result, expr->id()); | 9106 return ast_context()->ReturnInstruction(result, expr->id()); |
9103 } | 9107 } |
9104 | 9108 |
9105 // Code below assumes that we don't fall through. | 9109 // Code below assumes that we don't fall through. |
9106 UNREACHABLE(); | 9110 UNREACHABLE(); |
9107 } else if (op == Token::IN) { | 9111 } else if (op == Token::IN) { |
9108 HIn* result = new(zone()) HIn(context, left, right); | 9112 HValue* function = AddLoadJSBuiltin(Builtins::IN, context); |
9113 Add<HPushArgument>(left); | |
9114 Add<HPushArgument>(right); | |
9115 HInstruction* result = new(zone()) HInvokeFunction(context, function, 2); | |
Michael Starzinger
2013/07/05 13:47:49
Likewise.
| |
9109 result->set_position(expr->position()); | 9116 result->set_position(expr->position()); |
9110 return ast_context()->ReturnInstruction(result, expr->id()); | 9117 return ast_context()->ReturnInstruction(result, expr->id()); |
9111 } | 9118 } |
9112 | 9119 |
9113 // Cases handled below depend on collected type feedback. They should | 9120 // Cases handled below depend on collected type feedback. They should |
9114 // soft deoptimize when there is no type feedback. | 9121 // soft deoptimize when there is no type feedback. |
9115 if (combined_type->Is(Type::None())) { | 9122 if (combined_type->Is(Type::None())) { |
9116 AddSoftDeoptimize(); | 9123 AddSoftDeoptimize(); |
9117 combined_type = left_type = right_type = handle(Type::Any(), isolate()); | 9124 combined_type = left_type = right_type = handle(Type::Any(), isolate()); |
9118 } | 9125 } |
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10817 if (ShouldProduceTraceOutput()) { | 10824 if (ShouldProduceTraceOutput()) { |
10818 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10825 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
10819 } | 10826 } |
10820 | 10827 |
10821 #ifdef DEBUG | 10828 #ifdef DEBUG |
10822 graph_->Verify(false); // No full verify. | 10829 graph_->Verify(false); // No full verify. |
10823 #endif | 10830 #endif |
10824 } | 10831 } |
10825 | 10832 |
10826 } } // namespace v8::internal | 10833 } } // namespace v8::internal |
OLD | NEW |