OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 // Code common for calls using the call stub. | 2088 // Code common for calls using the call stub. |
2089 ZoneList<Expression*>* args = expr->arguments(); | 2089 ZoneList<Expression*>* args = expr->arguments(); |
2090 int arg_count = args->length(); | 2090 int arg_count = args->length(); |
2091 { PreservePositionScope scope(masm()->positions_recorder()); | 2091 { PreservePositionScope scope(masm()->positions_recorder()); |
2092 for (int i = 0; i < arg_count; i++) { | 2092 for (int i = 0; i < arg_count; i++) { |
2093 VisitForStackValue(args->at(i)); | 2093 VisitForStackValue(args->at(i)); |
2094 } | 2094 } |
2095 } | 2095 } |
2096 // Record source position for debugger. | 2096 // Record source position for debugger. |
2097 SetSourcePosition(expr->position()); | 2097 SetSourcePosition(expr->position()); |
| 2098 |
| 2099 // Record call targets in unoptimized code, but not in the snapshot. |
| 2100 bool record_call_target = !Serializer::enabled(); |
| 2101 if (record_call_target) { |
| 2102 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); |
| 2103 } |
2098 CallFunctionStub stub(arg_count, flags); | 2104 CallFunctionStub stub(arg_count, flags); |
2099 __ CallStub(&stub); | 2105 __ CallStub(&stub); |
| 2106 if (record_call_target) { |
| 2107 // There is a one element cache in the instruction stream. |
| 2108 #ifdef DEBUG |
| 2109 int return_site_offset = masm()->pc_offset(); |
| 2110 #endif |
| 2111 Handle<Object> uninitialized = |
| 2112 CallFunctionStub::UninitializedSentinel(isolate()); |
| 2113 Handle<JSGlobalPropertyCell> cell = |
| 2114 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); |
| 2115 __ test(eax, Immediate(cell)); |
| 2116 // Patching code in the stub assumes the opcode is 1 byte and there is |
| 2117 // word for a pointer in the operand. |
| 2118 ASSERT(masm()->pc_offset() - return_site_offset >= 1 + kPointerSize); |
| 2119 } |
| 2120 |
2100 RecordJSReturnSite(expr); | 2121 RecordJSReturnSite(expr); |
2101 // Restore context register. | 2122 // Restore context register. |
2102 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2123 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2103 | 2124 |
2104 decrement_stack_height(arg_count + 1); | 2125 decrement_stack_height(arg_count + 1); |
2105 context()->DropAndPlug(1, eax); | 2126 context()->DropAndPlug(1, eax); |
2106 } | 2127 } |
2107 | 2128 |
2108 | 2129 |
2109 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, | 2130 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, |
(...skipping 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4322 *context_length = 0; | 4343 *context_length = 0; |
4323 return previous_; | 4344 return previous_; |
4324 } | 4345 } |
4325 | 4346 |
4326 | 4347 |
4327 #undef __ | 4348 #undef __ |
4328 | 4349 |
4329 } } // namespace v8::internal | 4350 } } // namespace v8::internal |
4330 | 4351 |
4331 #endif // V8_TARGET_ARCH_IA32 | 4352 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |