Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 8111006: Allow new-space JSFunction objects as constant-function properties. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2276 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 if (source->IsSmi()) { 2287 if (source->IsSmi()) {
2288 Push(Smi::cast(*source)); 2288 Push(Smi::cast(*source));
2289 } else { 2289 } else {
2290 ASSERT(source->IsHeapObject()); 2290 ASSERT(source->IsHeapObject());
2291 movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT); 2291 movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT);
2292 push(kScratchRegister); 2292 push(kScratchRegister);
2293 } 2293 }
2294 } 2294 }
2295 2295
2296 2296
2297 void MacroAssembler::LoadHeapObject(Register result,
2298 Handle<HeapObject> object) {
2299 if (isolate()->heap()->InNewSpace(*object)) {
2300 Handle<JSGlobalPropertyCell> cell =
2301 isolate()->factory()->NewJSGlobalPropertyCell(object);
2302 movq(result, cell, RelocInfo::GLOBAL_PROPERTY_CELL);
2303 movq(result, Operand(result, 0));
2304 } else {
2305 Move(result, object);
2306 }
2307 }
2308
2309
2310 void MacroAssembler::PushHeapObject(Handle<HeapObject> object) {
2311 if (isolate()->heap()->InNewSpace(*object)) {
2312 Handle<JSGlobalPropertyCell> cell =
2313 isolate()->factory()->NewJSGlobalPropertyCell(object);
2314 movq(kScratchRegister, cell, RelocInfo::GLOBAL_PROPERTY_CELL);
2315 movq(kScratchRegister, Operand(kScratchRegister, 0));
2316 push(kScratchRegister);
2317 } else {
2318 Push(object);
2319 }
2320 }
2321
2322
2323 void MacroAssembler::LoadGlobalCell(Register dst,
2324 Handle<JSGlobalPropertyCell> cell) {
2325 if (dst.is(rax)) {
2326 load_rax(cell.location(), RelocInfo::GLOBAL_PROPERTY_CELL);
2327 } else {
2328 movq(dst, cell, RelocInfo::GLOBAL_PROPERTY_CELL);
2329 movq(dst, Operand(dst, 0));
2330 }
2331 }
2332
2333
2297 void MacroAssembler::Push(Smi* source) { 2334 void MacroAssembler::Push(Smi* source) {
2298 intptr_t smi = reinterpret_cast<intptr_t>(source); 2335 intptr_t smi = reinterpret_cast<intptr_t>(source);
2299 if (is_int32(smi)) { 2336 if (is_int32(smi)) {
2300 push(Immediate(static_cast<int32_t>(smi))); 2337 push(Immediate(static_cast<int32_t>(smi)));
2301 } else { 2338 } else {
2302 Register constant = GetSmiConstant(source); 2339 Register constant = GetSmiConstant(source);
2303 push(constant); 2340 push(constant);
2304 } 2341 }
2305 } 2342 }
2306 2343
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
3052 FieldOperand(rdx, SharedFunctionInfo::kFormalParameterCountOffset)); 3089 FieldOperand(rdx, SharedFunctionInfo::kFormalParameterCountOffset));
3053 // Advances rdx to the end of the Code object header, to the start of 3090 // Advances rdx to the end of the Code object header, to the start of
3054 // the executable code. 3091 // the executable code.
3055 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); 3092 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset));
3056 3093
3057 ParameterCount expected(rbx); 3094 ParameterCount expected(rbx);
3058 InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind); 3095 InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind);
3059 } 3096 }
3060 3097
3061 3098
3062 void MacroAssembler::InvokeFunction(JSFunction* function, 3099 void MacroAssembler::InvokeFunction(JSFunction* function,
Vyacheslav Egorov (Chromium) 2011/10/12 12:36:05 check all callers for gc safeness.
3063 const ParameterCount& actual, 3100 const ParameterCount& actual,
3064 InvokeFlag flag, 3101 InvokeFlag flag,
3065 const CallWrapper& call_wrapper, 3102 const CallWrapper& call_wrapper,
3066 CallKind call_kind) { 3103 CallKind call_kind) {
3067 // You can't call a function without a valid frame. 3104 // You can't call a function without a valid frame.
3068 ASSERT(flag == JUMP_FUNCTION || has_frame()); 3105 ASSERT(flag == JUMP_FUNCTION || has_frame());
3069 3106
3070 ASSERT(function->is_compiled()); 3107 ASSERT(function->is_compiled());
3071 // Get the function and setup the context. 3108 // Get the function and setup the context.
3072 Move(rdi, Handle<JSFunction>(function)); 3109 LoadHeapObject(rdi, Handle<JSFunction>(function));
3073 movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); 3110 movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
3074 3111
3075 if (V8::UseCrankshaft()) { 3112 if (V8::UseCrankshaft()) {
3076 // Since Crankshaft can recompile a function, we need to load 3113 // Since Crankshaft can recompile a function, we need to load
3077 // the Code object every time we call the function. 3114 // the Code object every time we call the function.
3078 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); 3115 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset));
3079 ParameterCount expected(function->shared()->formal_parameter_count()); 3116 ParameterCount expected(function->shared()->formal_parameter_count());
3080 InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind); 3117 InvokeCode(rdx, expected, actual, flag, call_wrapper, call_kind);
3081 } else { 3118 } else {
3082 // Invoke the cached code. 3119 // Invoke the cached code.
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
4274 4311
4275 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); 4312 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask));
4276 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); 4313 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length);
4277 4314
4278 bind(&done); 4315 bind(&done);
4279 } 4316 }
4280 4317
4281 } } // namespace v8::internal 4318 } } // namespace v8::internal
4282 4319
4283 #endif // V8_TARGET_ARCH_X64 4320 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698