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 5387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5398 Handle<JSObject> holder; | 5398 Handle<JSObject> holder; |
5399 if (LookupAccessorPair(map, name, &accessors, &holder)) { | 5399 if (LookupAccessorPair(map, name, &accessors, &holder)) { |
5400 load = BuildCallGetter(object, map, accessors, holder); | 5400 load = BuildCallGetter(object, map, accessors, holder); |
5401 } else { | 5401 } else { |
5402 load = BuildLoadNamedMonomorphic(object, name, prop, map); | 5402 load = BuildLoadNamedMonomorphic(object, name, prop, map); |
5403 } | 5403 } |
5404 } else { | 5404 } else { |
5405 load = BuildLoadNamedGeneric(object, name, prop); | 5405 load = BuildLoadNamedGeneric(object, name, prop); |
5406 } | 5406 } |
5407 PushAndAdd(load); | 5407 PushAndAdd(load); |
5408 if (load->HasObservableSideEffects()) AddSimulate(expr->CompoundLoadId()); | 5408 if (load->HasObservableSideEffects()) AddSimulate(prop->LoadId()); |
5409 | 5409 |
5410 CHECK_ALIVE(VisitForValue(expr->value())); | 5410 CHECK_ALIVE(VisitForValue(expr->value())); |
5411 HValue* right = Pop(); | 5411 HValue* right = Pop(); |
5412 HValue* left = Pop(); | 5412 HValue* left = Pop(); |
5413 | 5413 |
5414 HInstruction* instr = BuildBinaryOperation(operation, left, right); | 5414 HInstruction* instr = BuildBinaryOperation(operation, left, right); |
5415 PushAndAdd(instr); | 5415 PushAndAdd(instr); |
5416 if (instr->HasObservableSideEffects()) AddSimulate(operation->id()); | 5416 if (instr->HasObservableSideEffects()) AddSimulate(operation->id()); |
5417 | 5417 |
5418 HInstruction* store; | 5418 HInstruction* store; |
(...skipping 23 matching lines...) Expand all Loading... |
5442 | 5442 |
5443 } else { | 5443 } else { |
5444 // Keyed property. | 5444 // Keyed property. |
5445 CHECK_ALIVE(VisitForValue(prop->obj())); | 5445 CHECK_ALIVE(VisitForValue(prop->obj())); |
5446 CHECK_ALIVE(VisitForValue(prop->key())); | 5446 CHECK_ALIVE(VisitForValue(prop->key())); |
5447 HValue* obj = environment()->ExpressionStackAt(1); | 5447 HValue* obj = environment()->ExpressionStackAt(1); |
5448 HValue* key = environment()->ExpressionStackAt(0); | 5448 HValue* key = environment()->ExpressionStackAt(0); |
5449 | 5449 |
5450 bool has_side_effects = false; | 5450 bool has_side_effects = false; |
5451 HValue* load = HandleKeyedElementAccess( | 5451 HValue* load = HandleKeyedElementAccess( |
5452 obj, key, NULL, prop, expr->CompoundLoadId(), RelocInfo::kNoPosition, | 5452 obj, key, NULL, prop, prop->LoadId(), RelocInfo::kNoPosition, |
5453 false, // is_store | 5453 false, // is_store |
5454 &has_side_effects); | 5454 &has_side_effects); |
5455 Push(load); | 5455 Push(load); |
5456 if (has_side_effects) AddSimulate(expr->CompoundLoadId()); | 5456 if (has_side_effects) AddSimulate(prop->LoadId()); |
5457 | 5457 |
5458 | 5458 |
5459 CHECK_ALIVE(VisitForValue(expr->value())); | 5459 CHECK_ALIVE(VisitForValue(expr->value())); |
5460 HValue* right = Pop(); | 5460 HValue* right = Pop(); |
5461 HValue* left = Pop(); | 5461 HValue* left = Pop(); |
5462 | 5462 |
5463 HInstruction* instr = BuildBinaryOperation(operation, left, right); | 5463 HInstruction* instr = BuildBinaryOperation(operation, left, right); |
5464 PushAndAdd(instr); | 5464 PushAndAdd(instr); |
5465 if (instr->HasObservableSideEffects()) AddSimulate(operation->id()); | 5465 if (instr->HasObservableSideEffects()) AddSimulate(operation->id()); |
5466 | 5466 |
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6927 } | 6927 } |
6928 | 6928 |
6929 | 6929 |
6930 bool HGraphBuilder::TryInlineGetter(Handle<JSFunction> getter, | 6930 bool HGraphBuilder::TryInlineGetter(Handle<JSFunction> getter, |
6931 Property* prop) { | 6931 Property* prop) { |
6932 return TryInline(CALL_AS_METHOD, | 6932 return TryInline(CALL_AS_METHOD, |
6933 getter, | 6933 getter, |
6934 0, | 6934 0, |
6935 NULL, | 6935 NULL, |
6936 prop->id(), | 6936 prop->id(), |
6937 prop->ReturnId(), | 6937 prop->LoadId(), |
6938 NORMAL_RETURN); | 6938 NORMAL_RETURN); |
6939 } | 6939 } |
6940 | 6940 |
6941 | 6941 |
6942 bool HGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr, bool drop_extra) { | 6942 bool HGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr, bool drop_extra) { |
6943 if (!expr->target()->shared()->HasBuiltinFunctionId()) return false; | 6943 if (!expr->target()->shared()->HasBuiltinFunctionId()) return false; |
6944 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); | 6944 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); |
6945 switch (id) { | 6945 switch (id) { |
6946 case kMathRound: | 6946 case kMathRound: |
6947 case kMathAbs: | 6947 case kMathAbs: |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7866 Handle<JSObject> holder; | 7866 Handle<JSObject> holder; |
7867 if (LookupAccessorPair(map, name, &accessors, &holder)) { | 7867 if (LookupAccessorPair(map, name, &accessors, &holder)) { |
7868 load = BuildCallGetter(object, map, accessors, holder); | 7868 load = BuildCallGetter(object, map, accessors, holder); |
7869 } else { | 7869 } else { |
7870 load = BuildLoadNamedMonomorphic(object, name, prop, map); | 7870 load = BuildLoadNamedMonomorphic(object, name, prop, map); |
7871 } | 7871 } |
7872 } else { | 7872 } else { |
7873 load = BuildLoadNamedGeneric(object, name, prop); | 7873 load = BuildLoadNamedGeneric(object, name, prop); |
7874 } | 7874 } |
7875 PushAndAdd(load); | 7875 PushAndAdd(load); |
7876 if (load->HasObservableSideEffects()) AddSimulate(expr->CountId()); | 7876 if (load->HasObservableSideEffects()) AddSimulate(prop->LoadId()); |
7877 | 7877 |
7878 after = BuildIncrement(returns_original_input, expr); | 7878 after = BuildIncrement(returns_original_input, expr); |
7879 input = Pop(); | 7879 input = Pop(); |
7880 | 7880 |
7881 HInstruction* store; | 7881 HInstruction* store; |
7882 if (map.is_null()) { | 7882 if (map.is_null()) { |
7883 // If we don't know the monomorphic type, do a generic store. | 7883 // If we don't know the monomorphic type, do a generic store. |
7884 CHECK_ALIVE(store = BuildStoreNamedGeneric(object, name, after)); | 7884 CHECK_ALIVE(store = BuildStoreNamedGeneric(object, name, after)); |
7885 } else { | 7885 } else { |
7886 Handle<AccessorPair> accessors; | 7886 Handle<AccessorPair> accessors; |
(...skipping 22 matching lines...) Expand all Loading... |
7909 // Keyed property. | 7909 // Keyed property. |
7910 if (returns_original_input) Push(graph_->GetConstantUndefined()); | 7910 if (returns_original_input) Push(graph_->GetConstantUndefined()); |
7911 | 7911 |
7912 CHECK_ALIVE(VisitForValue(prop->obj())); | 7912 CHECK_ALIVE(VisitForValue(prop->obj())); |
7913 CHECK_ALIVE(VisitForValue(prop->key())); | 7913 CHECK_ALIVE(VisitForValue(prop->key())); |
7914 HValue* obj = environment()->ExpressionStackAt(1); | 7914 HValue* obj = environment()->ExpressionStackAt(1); |
7915 HValue* key = environment()->ExpressionStackAt(0); | 7915 HValue* key = environment()->ExpressionStackAt(0); |
7916 | 7916 |
7917 bool has_side_effects = false; | 7917 bool has_side_effects = false; |
7918 HValue* load = HandleKeyedElementAccess( | 7918 HValue* load = HandleKeyedElementAccess( |
7919 obj, key, NULL, prop, expr->CountId(), RelocInfo::kNoPosition, | 7919 obj, key, NULL, prop, prop->LoadId(), RelocInfo::kNoPosition, |
7920 false, // is_store | 7920 false, // is_store |
7921 &has_side_effects); | 7921 &has_side_effects); |
7922 Push(load); | 7922 Push(load); |
7923 if (has_side_effects) AddSimulate(expr->CountId()); | 7923 if (has_side_effects) AddSimulate(prop->LoadId()); |
7924 | 7924 |
7925 after = BuildIncrement(returns_original_input, expr); | 7925 after = BuildIncrement(returns_original_input, expr); |
7926 input = Pop(); | 7926 input = Pop(); |
7927 | 7927 |
7928 expr->RecordTypeFeedback(oracle(), zone()); | 7928 expr->RecordTypeFeedback(oracle(), zone()); |
7929 HandleKeyedElementAccess(obj, key, after, expr, expr->AssignmentId(), | 7929 HandleKeyedElementAccess(obj, key, after, expr, expr->AssignmentId(), |
7930 RelocInfo::kNoPosition, | 7930 RelocInfo::kNoPosition, |
7931 true, // is_store | 7931 true, // is_store |
7932 &has_side_effects); | 7932 &has_side_effects); |
7933 | 7933 |
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9664 } | 9664 } |
9665 } | 9665 } |
9666 | 9666 |
9667 #ifdef DEBUG | 9667 #ifdef DEBUG |
9668 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9668 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
9669 if (allocator_ != NULL) allocator_->Verify(); | 9669 if (allocator_ != NULL) allocator_->Verify(); |
9670 #endif | 9670 #endif |
9671 } | 9671 } |
9672 | 9672 |
9673 } } // namespace v8::internal | 9673 } } // namespace v8::internal |
OLD | NEW |