OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3101 // ------------------------------------------- | 3101 // ------------------------------------------- |
3102 // JavaScript example: 'array[index](1, 2, 3)' | 3102 // JavaScript example: 'array[index](1, 2, 3)' |
3103 // ------------------------------------------- | 3103 // ------------------------------------------- |
3104 | 3104 |
3105 // Load the function to call from the property through a reference. | 3105 // Load the function to call from the property through a reference. |
3106 if (property->is_synthetic()) { | 3106 if (property->is_synthetic()) { |
3107 Reference ref(this, property, false); | 3107 Reference ref(this, property, false); |
3108 ref.GetValue(); | 3108 ref.GetValue(); |
3109 // Use global object as receiver. | 3109 // Use global object as receiver. |
3110 LoadGlobalReceiver(); | 3110 LoadGlobalReceiver(); |
| 3111 // Call the function. |
| 3112 CallWithArguments(args, RECEIVER_MIGHT_BE_VALUE, node->position()); |
3111 } else { | 3113 } else { |
3112 Reference ref(this, property, false); | 3114 // Push the receiver onto the frame. |
3113 ASSERT(ref.size() == 2); | 3115 Load(property->obj()); |
3114 Result key = frame_->Pop(); | 3116 |
3115 frame_->Dup(); // Duplicate the receiver. | 3117 // Load the arguments. |
3116 frame_->Push(&key); | 3118 int arg_count = args->length(); |
3117 ref.GetValue(); | 3119 for (int i = 0; i < arg_count; i++) { |
3118 // Top of frame contains function to call, with duplicate copy of | 3120 Load(args->at(i)); |
3119 // receiver below it. Swap them. | 3121 frame_->SpillTop(); |
3120 Result function = frame_->Pop(); | 3122 } |
3121 Result receiver = frame_->Pop(); | 3123 |
3122 frame_->Push(&function); | 3124 // Load the name of the function. |
3123 frame_->Push(&receiver); | 3125 Load(property->key()); |
| 3126 |
| 3127 // Call the IC initialization code. |
| 3128 CodeForSourcePosition(node->position()); |
| 3129 Result result = frame_->CallKeyedCallIC(RelocInfo::CODE_TARGET, |
| 3130 arg_count, |
| 3131 loop_nesting()); |
| 3132 frame_->RestoreContextRegister(); |
| 3133 frame_->Push(&result); |
3124 } | 3134 } |
3125 | |
3126 // Call the function. | |
3127 CallWithArguments(args, RECEIVER_MIGHT_BE_VALUE, node->position()); | |
3128 } | 3135 } |
3129 | |
3130 } else { | 3136 } else { |
3131 // ---------------------------------- | 3137 // ---------------------------------- |
3132 // JavaScript example: 'foo(1, 2, 3)' // foo is not global | 3138 // JavaScript example: 'foo(1, 2, 3)' // foo is not global |
3133 // ---------------------------------- | 3139 // ---------------------------------- |
3134 | 3140 |
3135 // Load the function. | 3141 // Load the function. |
3136 Load(function); | 3142 Load(function); |
3137 | 3143 |
3138 // Pass the global proxy as the receiver. | 3144 // Pass the global proxy as the receiver. |
3139 LoadGlobalReceiver(); | 3145 LoadGlobalReceiver(); |
(...skipping 8804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11944 } | 11950 } |
11945 | 11951 |
11946 #endif | 11952 #endif |
11947 | 11953 |
11948 | 11954 |
11949 #undef __ | 11955 #undef __ |
11950 | 11956 |
11951 } } // namespace v8::internal | 11957 } } // namespace v8::internal |
11952 | 11958 |
11953 #endif // V8_TARGET_ARCH_X64 | 11959 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |