| 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 2220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2231 if (source->IsSmi()) { | 2231 if (source->IsSmi()) { |
| 2232 Push(Smi::cast(*source)); | 2232 Push(Smi::cast(*source)); |
| 2233 } else { | 2233 } else { |
| 2234 ASSERT(source->IsHeapObject()); | 2234 ASSERT(source->IsHeapObject()); |
| 2235 movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT); | 2235 movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT); |
| 2236 push(kScratchRegister); | 2236 push(kScratchRegister); |
| 2237 } | 2237 } |
| 2238 } | 2238 } |
| 2239 | 2239 |
| 2240 | 2240 |
| 2241 void MacroAssembler::LoadHeapObject(Register result, |
| 2242 Handle<HeapObject> object) { |
| 2243 if (isolate()->heap()->InNewSpace(*object)) { |
| 2244 Handle<JSGlobalPropertyCell> cell = |
| 2245 isolate()->factory()->NewJSGlobalPropertyCell(object); |
| 2246 movq(result, cell, RelocInfo::GLOBAL_PROPERTY_CELL); |
| 2247 movq(result, Operand(result, 0)); |
| 2248 } else { |
| 2249 Move(result, object); |
| 2250 } |
| 2251 } |
| 2252 |
| 2253 |
| 2254 void MacroAssembler::PushHeapObject(Handle<HeapObject> object) { |
| 2255 if (isolate()->heap()->InNewSpace(*object)) { |
| 2256 Handle<JSGlobalPropertyCell> cell = |
| 2257 isolate()->factory()->NewJSGlobalPropertyCell(object); |
| 2258 movq(kScratchRegister, cell, RelocInfo::GLOBAL_PROPERTY_CELL); |
| 2259 movq(kScratchRegister, Operand(kScratchRegister, 0)); |
| 2260 push(kScratchRegister); |
| 2261 } else { |
| 2262 Push(object); |
| 2263 } |
| 2264 } |
| 2265 |
| 2266 |
| 2267 void MacroAssembler::LoadGlobalCell(Register dst, |
| 2268 Handle<JSGlobalPropertyCell> cell) { |
| 2269 if (dst.is(rax)) { |
| 2270 load_rax(cell.location(), RelocInfo::GLOBAL_PROPERTY_CELL); |
| 2271 } else { |
| 2272 movq(dst, cell, RelocInfo::GLOBAL_PROPERTY_CELL); |
| 2273 movq(dst, Operand(dst, 0)); |
| 2274 } |
| 2275 } |
| 2276 |
| 2277 |
| 2241 void MacroAssembler::Push(Smi* source) { | 2278 void MacroAssembler::Push(Smi* source) { |
| 2242 intptr_t smi = reinterpret_cast<intptr_t>(source); | 2279 intptr_t smi = reinterpret_cast<intptr_t>(source); |
| 2243 if (is_int32(smi)) { | 2280 if (is_int32(smi)) { |
| 2244 push(Immediate(static_cast<int32_t>(smi))); | 2281 push(Immediate(static_cast<int32_t>(smi))); |
| 2245 } else { | 2282 } else { |
| 2246 Register constant = GetSmiConstant(source); | 2283 Register constant = GetSmiConstant(source); |
| 2247 push(constant); | 2284 push(constant); |
| 2248 } | 2285 } |
| 2249 } | 2286 } |
| 2250 | 2287 |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3042 | 3079 |
| 3043 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, | 3080 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, |
| 3044 const ParameterCount& actual, | 3081 const ParameterCount& actual, |
| 3045 InvokeFlag flag, | 3082 InvokeFlag flag, |
| 3046 const CallWrapper& call_wrapper, | 3083 const CallWrapper& call_wrapper, |
| 3047 CallKind call_kind) { | 3084 CallKind call_kind) { |
| 3048 // You can't call a function without a valid frame. | 3085 // You can't call a function without a valid frame. |
| 3049 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 3086 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
| 3050 | 3087 |
| 3051 // Get the function and setup the context. | 3088 // Get the function and setup the context. |
| 3052 Move(rdi, function); | 3089 LoadHeapObject(rdi, function); |
| 3053 movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 3090 movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 3054 | 3091 |
| 3055 // We call indirectly through the code field in the function to | 3092 // We call indirectly through the code field in the function to |
| 3056 // allow recompilation to take effect without changing any of the | 3093 // allow recompilation to take effect without changing any of the |
| 3057 // call sites. | 3094 // call sites. |
| 3058 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | 3095 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
| 3059 ParameterCount expected(function->shared()->formal_parameter_count()); | 3096 ParameterCount expected(function->shared()->formal_parameter_count()); |
| 3060 InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind); | 3097 InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind); |
| 3061 } | 3098 } |
| 3062 | 3099 |
| (...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4242 | 4279 |
| 4243 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); | 4280 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); |
| 4244 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); | 4281 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); |
| 4245 | 4282 |
| 4246 bind(&done); | 4283 bind(&done); |
| 4247 } | 4284 } |
| 4248 | 4285 |
| 4249 } } // namespace v8::internal | 4286 } } // namespace v8::internal |
| 4250 | 4287 |
| 4251 #endif // V8_TARGET_ARCH_X64 | 4288 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |