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 5403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5414 Handle<JSObject> holder; | 5414 Handle<JSObject> holder; |
5415 if (LookupAccessorPair(map, name, &accessors, &holder)) { | 5415 if (LookupAccessorPair(map, name, &accessors, &holder)) { |
5416 load = BuildCallGetter(object, map, accessors, holder); | 5416 load = BuildCallGetter(object, map, accessors, holder); |
5417 } else { | 5417 } else { |
5418 load = BuildLoadNamedMonomorphic(object, name, prop, map); | 5418 load = BuildLoadNamedMonomorphic(object, name, prop, map); |
5419 } | 5419 } |
5420 } else { | 5420 } else { |
5421 load = BuildLoadNamedGeneric(object, name, prop); | 5421 load = BuildLoadNamedGeneric(object, name, prop); |
5422 } | 5422 } |
5423 PushAndAdd(load); | 5423 PushAndAdd(load); |
5424 if (load->HasObservableSideEffects()) AddSimulate(expr->CompoundLoadId()); | 5424 if (load->HasObservableSideEffects()) AddSimulate(prop->LoadId()); |
5425 | 5425 |
5426 CHECK_ALIVE(VisitForValue(expr->value())); | 5426 CHECK_ALIVE(VisitForValue(expr->value())); |
5427 HValue* right = Pop(); | 5427 HValue* right = Pop(); |
5428 HValue* left = Pop(); | 5428 HValue* left = Pop(); |
5429 | 5429 |
5430 HInstruction* instr = BuildBinaryOperation(operation, left, right); | 5430 HInstruction* instr = BuildBinaryOperation(operation, left, right); |
5431 PushAndAdd(instr); | 5431 PushAndAdd(instr); |
5432 if (instr->HasObservableSideEffects()) AddSimulate(operation->id()); | 5432 if (instr->HasObservableSideEffects()) AddSimulate(operation->id()); |
5433 | 5433 |
5434 HInstruction* store; | 5434 HInstruction* store; |
(...skipping 23 matching lines...) Expand all Loading... |
5458 | 5458 |
5459 } else { | 5459 } else { |
5460 // Keyed property. | 5460 // Keyed property. |
5461 CHECK_ALIVE(VisitForValue(prop->obj())); | 5461 CHECK_ALIVE(VisitForValue(prop->obj())); |
5462 CHECK_ALIVE(VisitForValue(prop->key())); | 5462 CHECK_ALIVE(VisitForValue(prop->key())); |
5463 HValue* obj = environment()->ExpressionStackAt(1); | 5463 HValue* obj = environment()->ExpressionStackAt(1); |
5464 HValue* key = environment()->ExpressionStackAt(0); | 5464 HValue* key = environment()->ExpressionStackAt(0); |
5465 | 5465 |
5466 bool has_side_effects = false; | 5466 bool has_side_effects = false; |
5467 HValue* load = HandleKeyedElementAccess( | 5467 HValue* load = HandleKeyedElementAccess( |
5468 obj, key, NULL, prop, expr->CompoundLoadId(), RelocInfo::kNoPosition, | 5468 obj, key, NULL, prop, prop->LoadId(), RelocInfo::kNoPosition, |
5469 false, // is_store | 5469 false, // is_store |
5470 &has_side_effects); | 5470 &has_side_effects); |
5471 Push(load); | 5471 Push(load); |
5472 if (has_side_effects) AddSimulate(expr->CompoundLoadId()); | 5472 if (has_side_effects) AddSimulate(prop->LoadId()); |
5473 | 5473 |
5474 | 5474 |
5475 CHECK_ALIVE(VisitForValue(expr->value())); | 5475 CHECK_ALIVE(VisitForValue(expr->value())); |
5476 HValue* right = Pop(); | 5476 HValue* right = Pop(); |
5477 HValue* left = Pop(); | 5477 HValue* left = Pop(); |
5478 | 5478 |
5479 HInstruction* instr = BuildBinaryOperation(operation, left, right); | 5479 HInstruction* instr = BuildBinaryOperation(operation, left, right); |
5480 PushAndAdd(instr); | 5480 PushAndAdd(instr); |
5481 if (instr->HasObservableSideEffects()) AddSimulate(operation->id()); | 5481 if (instr->HasObservableSideEffects()) AddSimulate(operation->id()); |
5482 | 5482 |
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6949 } | 6949 } |
6950 | 6950 |
6951 | 6951 |
6952 bool HGraphBuilder::TryInlineGetter(Handle<JSFunction> getter, | 6952 bool HGraphBuilder::TryInlineGetter(Handle<JSFunction> getter, |
6953 Property* prop) { | 6953 Property* prop) { |
6954 return TryInline(CALL_AS_METHOD, | 6954 return TryInline(CALL_AS_METHOD, |
6955 getter, | 6955 getter, |
6956 0, | 6956 0, |
6957 NULL, | 6957 NULL, |
6958 prop->id(), | 6958 prop->id(), |
6959 prop->ReturnId(), | 6959 prop->LoadId(), |
6960 NORMAL_RETURN); | 6960 NORMAL_RETURN); |
6961 } | 6961 } |
6962 | 6962 |
6963 | 6963 |
6964 bool HGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr, bool drop_extra) { | 6964 bool HGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr, bool drop_extra) { |
6965 if (!expr->target()->shared()->HasBuiltinFunctionId()) return false; | 6965 if (!expr->target()->shared()->HasBuiltinFunctionId()) return false; |
6966 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); | 6966 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); |
6967 switch (id) { | 6967 switch (id) { |
6968 case kMathRound: | 6968 case kMathRound: |
6969 case kMathAbs: | 6969 case kMathAbs: |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7825 Handle<JSObject> holder; | 7825 Handle<JSObject> holder; |
7826 if (LookupAccessorPair(map, name, &accessors, &holder)) { | 7826 if (LookupAccessorPair(map, name, &accessors, &holder)) { |
7827 load = BuildCallGetter(object, map, accessors, holder); | 7827 load = BuildCallGetter(object, map, accessors, holder); |
7828 } else { | 7828 } else { |
7829 load = BuildLoadNamedMonomorphic(object, name, prop, map); | 7829 load = BuildLoadNamedMonomorphic(object, name, prop, map); |
7830 } | 7830 } |
7831 } else { | 7831 } else { |
7832 load = BuildLoadNamedGeneric(object, name, prop); | 7832 load = BuildLoadNamedGeneric(object, name, prop); |
7833 } | 7833 } |
7834 PushAndAdd(load); | 7834 PushAndAdd(load); |
7835 if (load->HasObservableSideEffects()) AddSimulate(expr->CountId()); | 7835 if (load->HasObservableSideEffects()) AddSimulate(prop->LoadId()); |
7836 | 7836 |
7837 after = BuildIncrement(returns_original_input, expr); | 7837 after = BuildIncrement(returns_original_input, expr); |
7838 input = Pop(); | 7838 input = Pop(); |
7839 | 7839 |
7840 HInstruction* store; | 7840 HInstruction* store; |
7841 if (!monomorphic) { | 7841 if (!monomorphic) { |
7842 // If we don't know the monomorphic type, do a generic store. | 7842 // If we don't know the monomorphic type, do a generic store. |
7843 CHECK_ALIVE(store = BuildStoreNamedGeneric(object, name, after)); | 7843 CHECK_ALIVE(store = BuildStoreNamedGeneric(object, name, after)); |
7844 } else { | 7844 } else { |
7845 Handle<AccessorPair> accessors; | 7845 Handle<AccessorPair> accessors; |
(...skipping 22 matching lines...) Expand all Loading... |
7868 // Keyed property. | 7868 // Keyed property. |
7869 if (returns_original_input) Push(graph_->GetConstantUndefined()); | 7869 if (returns_original_input) Push(graph_->GetConstantUndefined()); |
7870 | 7870 |
7871 CHECK_ALIVE(VisitForValue(prop->obj())); | 7871 CHECK_ALIVE(VisitForValue(prop->obj())); |
7872 CHECK_ALIVE(VisitForValue(prop->key())); | 7872 CHECK_ALIVE(VisitForValue(prop->key())); |
7873 HValue* obj = environment()->ExpressionStackAt(1); | 7873 HValue* obj = environment()->ExpressionStackAt(1); |
7874 HValue* key = environment()->ExpressionStackAt(0); | 7874 HValue* key = environment()->ExpressionStackAt(0); |
7875 | 7875 |
7876 bool has_side_effects = false; | 7876 bool has_side_effects = false; |
7877 HValue* load = HandleKeyedElementAccess( | 7877 HValue* load = HandleKeyedElementAccess( |
7878 obj, key, NULL, prop, expr->CountId(), RelocInfo::kNoPosition, | 7878 obj, key, NULL, prop, prop->LoadId(), RelocInfo::kNoPosition, |
7879 false, // is_store | 7879 false, // is_store |
7880 &has_side_effects); | 7880 &has_side_effects); |
7881 Push(load); | 7881 Push(load); |
7882 if (has_side_effects) AddSimulate(expr->CountId()); | 7882 if (has_side_effects) AddSimulate(prop->LoadId()); |
7883 | 7883 |
7884 after = BuildIncrement(returns_original_input, expr); | 7884 after = BuildIncrement(returns_original_input, expr); |
7885 input = Pop(); | 7885 input = Pop(); |
7886 | 7886 |
7887 expr->RecordTypeFeedback(oracle(), zone()); | 7887 expr->RecordTypeFeedback(oracle(), zone()); |
7888 HandleKeyedElementAccess(obj, key, after, expr, expr->AssignmentId(), | 7888 HandleKeyedElementAccess(obj, key, after, expr, expr->AssignmentId(), |
7889 RelocInfo::kNoPosition, | 7889 RelocInfo::kNoPosition, |
7890 true, // is_store | 7890 true, // is_store |
7891 &has_side_effects); | 7891 &has_side_effects); |
7892 | 7892 |
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9623 } | 9623 } |
9624 } | 9624 } |
9625 | 9625 |
9626 #ifdef DEBUG | 9626 #ifdef DEBUG |
9627 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9627 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
9628 if (allocator_ != NULL) allocator_->Verify(); | 9628 if (allocator_ != NULL) allocator_->Verify(); |
9629 #endif | 9629 #endif |
9630 } | 9630 } |
9631 | 9631 |
9632 } } // namespace v8::internal | 9632 } } // namespace v8::internal |
OLD | NEW |