| 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 = CacheCells::UninitializedSentinel(isolate()); |
| 2136 Handle<JSGlobalPropertyCell> cell = |
| 2137 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); |
| 2138 RecordCacheCell(expr->id(), cell); |
| 2139 __ mov(ebx, cell); |
| 2136 } | 2140 } |
| 2141 |
| 2137 CallFunctionStub stub(arg_count, flags); | 2142 CallFunctionStub stub(arg_count, flags); |
| 2138 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 2143 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
| 2139 __ CallStub(&stub, expr->id()); | 2144 __ 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 | 2145 |
| 2155 RecordJSReturnSite(expr); | 2146 RecordJSReturnSite(expr); |
| 2156 // Restore context register. | 2147 // Restore context register. |
| 2157 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2148 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 2158 context()->DropAndPlug(1, eax); | 2149 context()->DropAndPlug(1, eax); |
| 2159 } | 2150 } |
| 2160 | 2151 |
| 2161 | 2152 |
| 2162 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { | 2153 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
| 2163 // Push copy of the first argument or undefined if it doesn't exist. | 2154 // 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 } | 2309 } |
| 2319 | 2310 |
| 2320 // Call the construct call builtin that handles allocation and | 2311 // Call the construct call builtin that handles allocation and |
| 2321 // constructor invocation. | 2312 // constructor invocation. |
| 2322 SetSourcePosition(expr->position()); | 2313 SetSourcePosition(expr->position()); |
| 2323 | 2314 |
| 2324 // Load function and argument count into edi and eax. | 2315 // Load function and argument count into edi and eax. |
| 2325 __ SafeSet(eax, Immediate(arg_count)); | 2316 __ SafeSet(eax, Immediate(arg_count)); |
| 2326 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2317 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
| 2327 | 2318 |
| 2328 Handle<Code> construct_builtin = | 2319 // Record call targets in unoptimized code, but not in the snapshot. |
| 2329 isolate()->builtins()->JSConstructCall(); | 2320 CallFunctionFlags flags; |
| 2330 __ call(construct_builtin, RelocInfo::CONSTRUCT_CALL); | 2321 if (!Serializer::enabled()) { |
| 2322 flags = RECORD_CALL_TARGET; |
| 2323 Handle<Object> uninitialized = CacheCells::UninitializedSentinel(isolate()); |
| 2324 Handle<JSGlobalPropertyCell> cell = |
| 2325 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); |
| 2326 RecordCacheCell(expr->id(), cell); |
| 2327 __ mov(ebx, cell); |
| 2328 } else { |
| 2329 flags = NO_CALL_FUNCTION_FLAGS; |
| 2330 } |
| 2331 |
| 2332 CallConstructStub stub(flags); |
| 2333 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| 2331 context()->Plug(eax); | 2334 context()->Plug(eax); |
| 2332 } | 2335 } |
| 2333 | 2336 |
| 2334 | 2337 |
| 2335 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 2338 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
| 2336 ZoneList<Expression*>* args = expr->arguments(); | 2339 ZoneList<Expression*>* args = expr->arguments(); |
| 2337 ASSERT(args->length() == 1); | 2340 ASSERT(args->length() == 1); |
| 2338 | 2341 |
| 2339 VisitForAccumulatorValue(args->at(0)); | 2342 VisitForAccumulatorValue(args->at(0)); |
| 2340 | 2343 |
| (...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4380 *context_length = 0; | 4383 *context_length = 0; |
| 4381 return previous_; | 4384 return previous_; |
| 4382 } | 4385 } |
| 4383 | 4386 |
| 4384 | 4387 |
| 4385 #undef __ | 4388 #undef __ |
| 4386 | 4389 |
| 4387 } } // namespace v8::internal | 4390 } } // namespace v8::internal |
| 4388 | 4391 |
| 4389 #endif // V8_TARGET_ARCH_IA32 | 4392 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |