| 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 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2123 int arg_count = args->length(); | 2123 int arg_count = args->length(); |
| 2124 { PreservePositionScope scope(masm()->positions_recorder()); | 2124 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2125 for (int i = 0; i < arg_count; i++) { | 2125 for (int i = 0; i < arg_count; i++) { |
| 2126 VisitForStackValue(args->at(i)); | 2126 VisitForStackValue(args->at(i)); |
| 2127 } | 2127 } |
| 2128 } | 2128 } |
| 2129 // Record source position for debugger. | 2129 // Record source position for debugger. |
| 2130 SetSourcePosition(expr->position()); | 2130 SetSourcePosition(expr->position()); |
| 2131 | 2131 |
| 2132 // Record call targets in unoptimized code, but not in the snapshot. | 2132 // Record call targets in unoptimized code, but not in the snapshot. |
| 2133 bool record_call_target = !Serializer::enabled(); | 2133 if (!Serializer::enabled()) { |
| 2134 if (record_call_target) { | |
| 2135 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); | 2134 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); |
| 2135 Handle<Object> uninitialized = |
| 2136 TypeFeedbackCells::UninitializedSentinel(isolate()); |
| 2137 Handle<JSGlobalPropertyCell> cell = |
| 2138 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); |
| 2139 RecordTypeFeedbackCell(expr->id(), cell); |
| 2140 __ mov(ebx, cell); |
| 2136 } | 2141 } |
| 2142 |
| 2137 CallFunctionStub stub(arg_count, flags); | 2143 CallFunctionStub stub(arg_count, flags); |
| 2138 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 2144 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
| 2139 __ CallStub(&stub, expr->id()); | 2145 __ CallStub(&stub, expr->id()); |
| 2140 if (record_call_target) { | |
| 2141 // There is a one element cache in the instruction stream. | |
| 2142 #ifdef DEBUG | |
| 2143 int return_site_offset = masm()->pc_offset(); | |
| 2144 #endif | |
| 2145 Handle<Object> uninitialized = | |
| 2146 CallFunctionStub::UninitializedSentinel(isolate()); | |
| 2147 Handle<JSGlobalPropertyCell> cell = | |
| 2148 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); | |
| 2149 __ test(eax, Immediate(cell)); | |
| 2150 // Patching code in the stub assumes the opcode is 1 byte and there is | |
| 2151 // word for a pointer in the operand. | |
| 2152 ASSERT(masm()->pc_offset() - return_site_offset >= 1 + kPointerSize); | |
| 2153 } | |
| 2154 | 2146 |
| 2155 RecordJSReturnSite(expr); | 2147 RecordJSReturnSite(expr); |
| 2156 // Restore context register. | 2148 // Restore context register. |
| 2157 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2149 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 2158 context()->DropAndPlug(1, eax); | 2150 context()->DropAndPlug(1, eax); |
| 2159 } | 2151 } |
| 2160 | 2152 |
| 2161 | 2153 |
| 2162 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { | 2154 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
| 2163 // Push copy of the first argument or undefined if it doesn't exist. | 2155 // Push copy of the first argument or undefined if it doesn't exist. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2318 } | 2310 } |
| 2319 | 2311 |
| 2320 // Call the construct call builtin that handles allocation and | 2312 // Call the construct call builtin that handles allocation and |
| 2321 // constructor invocation. | 2313 // constructor invocation. |
| 2322 SetSourcePosition(expr->position()); | 2314 SetSourcePosition(expr->position()); |
| 2323 | 2315 |
| 2324 // Load function and argument count into edi and eax. | 2316 // Load function and argument count into edi and eax. |
| 2325 __ SafeSet(eax, Immediate(arg_count)); | 2317 __ SafeSet(eax, Immediate(arg_count)); |
| 2326 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2318 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
| 2327 | 2319 |
| 2328 Handle<Code> construct_builtin = | 2320 // Record call targets in unoptimized code, but not in the snapshot. |
| 2329 isolate()->builtins()->JSConstructCall(); | 2321 CallFunctionFlags flags; |
| 2330 __ call(construct_builtin, RelocInfo::CONSTRUCT_CALL); | 2322 if (!Serializer::enabled()) { |
| 2323 flags = RECORD_CALL_TARGET; |
| 2324 Handle<Object> uninitialized = |
| 2325 TypeFeedbackCells::UninitializedSentinel(isolate()); |
| 2326 Handle<JSGlobalPropertyCell> cell = |
| 2327 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); |
| 2328 RecordTypeFeedbackCell(expr->id(), cell); |
| 2329 __ mov(ebx, cell); |
| 2330 } else { |
| 2331 flags = NO_CALL_FUNCTION_FLAGS; |
| 2332 } |
| 2333 |
| 2334 CallConstructStub stub(flags); |
| 2335 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| 2331 context()->Plug(eax); | 2336 context()->Plug(eax); |
| 2332 } | 2337 } |
| 2333 | 2338 |
| 2334 | 2339 |
| 2335 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 2340 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
| 2336 ZoneList<Expression*>* args = expr->arguments(); | 2341 ZoneList<Expression*>* args = expr->arguments(); |
| 2337 ASSERT(args->length() == 1); | 2342 ASSERT(args->length() == 1); |
| 2338 | 2343 |
| 2339 VisitForAccumulatorValue(args->at(0)); | 2344 VisitForAccumulatorValue(args->at(0)); |
| 2340 | 2345 |
| (...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4380 *context_length = 0; | 4385 *context_length = 0; |
| 4381 return previous_; | 4386 return previous_; |
| 4382 } | 4387 } |
| 4383 | 4388 |
| 4384 | 4389 |
| 4385 #undef __ | 4390 #undef __ |
| 4386 | 4391 |
| 4387 } } // namespace v8::internal | 4392 } } // namespace v8::internal |
| 4388 | 4393 |
| 4389 #endif // V8_TARGET_ARCH_IA32 | 4394 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |