| 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 7767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7778 receiver_maps->first(), &holder_lookup); | 7778 receiver_maps->first(), &holder_lookup); |
| 7779 if (holder_lookup == CallOptimization::kHolderNotFound) return false; | 7779 if (holder_lookup == CallOptimization::kHolderNotFound) return false; |
| 7780 | 7780 |
| 7781 if (FLAG_trace_inlining) { | 7781 if (FLAG_trace_inlining) { |
| 7782 PrintF("Inlining api function "); | 7782 PrintF("Inlining api function "); |
| 7783 function->ShortPrint(); | 7783 function->ShortPrint(); |
| 7784 PrintF("\n"); | 7784 PrintF("\n"); |
| 7785 } | 7785 } |
| 7786 | 7786 |
| 7787 bool drop_extra = false; | 7787 bool drop_extra = false; |
| 7788 bool is_store = false; |
| 7788 switch (call_type) { | 7789 switch (call_type) { |
| 7789 case kCallApiFunction: | 7790 case kCallApiFunction: |
| 7790 case kCallApiMethod: | 7791 case kCallApiMethod: |
| 7791 // Need to check that none of the receiver maps could have changed. | 7792 // Need to check that none of the receiver maps could have changed. |
| 7792 Add<HCheckMaps>(receiver, receiver_maps, top_info()); | 7793 Add<HCheckMaps>(receiver, receiver_maps, top_info()); |
| 7793 // Need to ensure the chain between receiver and api_holder is intact. | 7794 // Need to ensure the chain between receiver and api_holder is intact. |
| 7794 if (holder_lookup == CallOptimization::kHolderFound) { | 7795 if (holder_lookup == CallOptimization::kHolderFound) { |
| 7795 AddCheckPrototypeMaps(api_holder, receiver_maps->first()); | 7796 AddCheckPrototypeMaps(api_holder, receiver_maps->first()); |
| 7796 } else { | 7797 } else { |
| 7797 ASSERT_EQ(holder_lookup, CallOptimization::kHolderIsReceiver); | 7798 ASSERT_EQ(holder_lookup, CallOptimization::kHolderIsReceiver); |
| 7798 } | 7799 } |
| 7799 // Includes receiver. | 7800 // Includes receiver. |
| 7800 PushArgumentsFromEnvironment(argc + 1); | 7801 PushArgumentsFromEnvironment(argc + 1); |
| 7801 // Drop function after call. | 7802 // Drop function after call. |
| 7802 drop_extra = true; | 7803 drop_extra = true; |
| 7803 break; | 7804 break; |
| 7804 case kCallApiGetter: | 7805 case kCallApiGetter: |
| 7805 // Receiver and prototype chain cannot have changed. | 7806 // Receiver and prototype chain cannot have changed. |
| 7806 ASSERT_EQ(0, argc); | 7807 ASSERT_EQ(0, argc); |
| 7807 ASSERT_EQ(NULL, receiver); | 7808 ASSERT_EQ(NULL, receiver); |
| 7808 // Receiver is on expression stack. | 7809 // Receiver is on expression stack. |
| 7809 receiver = Pop(); | 7810 receiver = Pop(); |
| 7810 Add<HPushArgument>(receiver); | 7811 Add<HPushArgument>(receiver); |
| 7811 break; | 7812 break; |
| 7812 case kCallApiSetter: | 7813 case kCallApiSetter: |
| 7813 { | 7814 { |
| 7815 is_store = true; |
| 7814 // Receiver and prototype chain cannot have changed. | 7816 // Receiver and prototype chain cannot have changed. |
| 7815 ASSERT_EQ(1, argc); | 7817 ASSERT_EQ(1, argc); |
| 7816 ASSERT_EQ(NULL, receiver); | 7818 ASSERT_EQ(NULL, receiver); |
| 7817 // Receiver and value are on expression stack. | 7819 // Receiver and value are on expression stack. |
| 7818 HValue* value = Pop(); | 7820 HValue* value = Pop(); |
| 7819 receiver = Pop(); | 7821 receiver = Pop(); |
| 7820 Add<HPushArgument>(receiver); | 7822 Add<HPushArgument>(receiver); |
| 7821 Add<HPushArgument>(value); | 7823 Add<HPushArgument>(value); |
| 7822 break; | 7824 break; |
| 7823 } | 7825 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 7849 Add<HConstant>(function), | 7851 Add<HConstant>(function), |
| 7850 call_data, | 7852 call_data, |
| 7851 holder, | 7853 holder, |
| 7852 api_function_address, | 7854 api_function_address, |
| 7853 context() | 7855 context() |
| 7854 }; | 7856 }; |
| 7855 | 7857 |
| 7856 CallInterfaceDescriptor* descriptor = | 7858 CallInterfaceDescriptor* descriptor = |
| 7857 isolate()->call_descriptor(Isolate::ApiFunctionCall); | 7859 isolate()->call_descriptor(Isolate::ApiFunctionCall); |
| 7858 | 7860 |
| 7859 CallApiFunctionStub stub(true, call_data_is_undefined, argc); | 7861 CallApiFunctionStub stub(is_store, call_data_is_undefined, argc); |
| 7860 Handle<Code> code = stub.GetCode(isolate()); | 7862 Handle<Code> code = stub.GetCode(isolate()); |
| 7861 HConstant* code_value = Add<HConstant>(code); | 7863 HConstant* code_value = Add<HConstant>(code); |
| 7862 | 7864 |
| 7863 ASSERT((sizeof(op_vals) / kPointerSize) == | 7865 ASSERT((sizeof(op_vals) / kPointerSize) == |
| 7864 descriptor->environment_length()); | 7866 descriptor->environment_length()); |
| 7865 | 7867 |
| 7866 HInstruction* call = New<HCallWithDescriptor>( | 7868 HInstruction* call = New<HCallWithDescriptor>( |
| 7867 code_value, argc + 1, descriptor, | 7869 code_value, argc + 1, descriptor, |
| 7868 Vector<HValue*>(op_vals, descriptor->environment_length())); | 7870 Vector<HValue*>(op_vals, descriptor->environment_length())); |
| 7869 | 7871 |
| (...skipping 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11284 if (ShouldProduceTraceOutput()) { | 11286 if (ShouldProduceTraceOutput()) { |
| 11285 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11287 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 11286 } | 11288 } |
| 11287 | 11289 |
| 11288 #ifdef DEBUG | 11290 #ifdef DEBUG |
| 11289 graph_->Verify(false); // No full verify. | 11291 graph_->Verify(false); // No full verify. |
| 11290 #endif | 11292 #endif |
| 11291 } | 11293 } |
| 11292 | 11294 |
| 11293 } } // namespace v8::internal | 11295 } } // namespace v8::internal |
| OLD | NEW |