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

Side by Side Diff: src/ia32/macro-assembler-ia32.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 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 2049 mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
2050 mov(ebx, FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); 2050 mov(ebx, FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset));
2051 SmiUntag(ebx); 2051 SmiUntag(ebx);
2052 2052
2053 ParameterCount expected(ebx); 2053 ParameterCount expected(ebx);
2054 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), 2054 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset),
2055 expected, actual, flag, call_wrapper, call_kind); 2055 expected, actual, flag, call_wrapper, call_kind);
2056 } 2056 }
2057 2057
2058 2058
2059 void MacroAssembler::InvokeFunction(JSFunction* function, 2059 void MacroAssembler::InvokeFunction(JSFunction* function,
Vyacheslav Egorov (Chromium) 2011/10/12 12:36:05 probably not gc safe. check all callers.
2060 const ParameterCount& actual, 2060 const ParameterCount& actual,
2061 InvokeFlag flag, 2061 InvokeFlag flag,
2062 const CallWrapper& call_wrapper, 2062 const CallWrapper& call_wrapper,
2063 CallKind call_kind) { 2063 CallKind call_kind) {
2064 // You can't call a function without a valid frame. 2064 // You can't call a function without a valid frame.
2065 ASSERT(flag == JUMP_FUNCTION || has_frame()); 2065 ASSERT(flag == JUMP_FUNCTION || has_frame());
2066 2066
2067 ASSERT(function->is_compiled()); 2067 ASSERT(function->is_compiled());
2068 // Get the function and setup the context. 2068 // Get the function and setup the context.
2069 mov(edi, Immediate(Handle<JSFunction>(function))); 2069 LoadHeapObject(edi, Handle<JSFunction>(function));
2070 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 2070 mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
2071 2071
2072 ParameterCount expected(function->shared()->formal_parameter_count()); 2072 ParameterCount expected(function->shared()->formal_parameter_count());
2073 if (V8::UseCrankshaft()) { 2073 if (V8::UseCrankshaft()) {
2074 // TODO(kasperl): For now, we always call indirectly through the 2074 // TODO(kasperl): For now, we always call indirectly through the
2075 // code field in the function to allow recompilation to take effect 2075 // code field in the function to allow recompilation to take effect
2076 // without changing any of the call sites. 2076 // without changing any of the call sites.
2077 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), 2077 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset),
2078 expected, actual, flag, call_wrapper, call_kind); 2078 expected, actual, flag, call_wrapper, call_kind);
2079 } else { 2079 } else {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 2194
2195 int MacroAssembler::SafepointRegisterStackIndex(int reg_code) { 2195 int MacroAssembler::SafepointRegisterStackIndex(int reg_code) {
2196 // The registers are pushed starting with the lowest encoding, 2196 // The registers are pushed starting with the lowest encoding,
2197 // which means that lowest encodings are furthest away from 2197 // which means that lowest encodings are furthest away from
2198 // the stack pointer. 2198 // the stack pointer.
2199 ASSERT(reg_code >= 0 && reg_code < kNumSafepointRegisters); 2199 ASSERT(reg_code >= 0 && reg_code < kNumSafepointRegisters);
2200 return kNumSafepointRegisters - reg_code - 1; 2200 return kNumSafepointRegisters - reg_code - 1;
2201 } 2201 }
2202 2202
2203 2203
2204 void MacroAssembler::LoadHeapObject(Register result,
2205 Handle<HeapObject> object) {
2206 if (isolate()->heap()->InNewSpace(*object)) {
2207 Handle<JSGlobalPropertyCell> cell =
2208 isolate()->factory()->NewJSGlobalPropertyCell(object);
2209 mov(result, Operand::Cell(cell));
2210 } else {
2211 mov(result, object);
2212 }
2213 }
2214
2215
2216 void MacroAssembler::PushHeapObject(Handle<HeapObject> object) {
2217 if (isolate()->heap()->InNewSpace(*object)) {
2218 Handle<JSGlobalPropertyCell> cell =
2219 isolate()->factory()->NewJSGlobalPropertyCell(object);
2220 push(Operand::Cell(cell));
2221 } else {
2222 Push(object);
2223 }
2224 }
2225
2226
2204 void MacroAssembler::Ret() { 2227 void MacroAssembler::Ret() {
2205 ret(0); 2228 ret(0);
2206 } 2229 }
2207 2230
2208 2231
2209 void MacroAssembler::Ret(int bytes_dropped, Register scratch) { 2232 void MacroAssembler::Ret(int bytes_dropped, Register scratch) {
2210 if (is_uint16(bytes_dropped)) { 2233 if (is_uint16(bytes_dropped)) {
2211 ret(bytes_dropped); 2234 ret(bytes_dropped);
2212 } else { 2235 } else {
2213 pop(scratch); 2236 pop(scratch);
(...skipping 13 matching lines...) Expand all
2227 } 2250 }
2228 2251
2229 2252
2230 void MacroAssembler::Move(Register dst, Register src) { 2253 void MacroAssembler::Move(Register dst, Register src) {
2231 if (!dst.is(src)) { 2254 if (!dst.is(src)) {
2232 mov(dst, src); 2255 mov(dst, src);
2233 } 2256 }
2234 } 2257 }
2235 2258
2236 2259
2237 void MacroAssembler::Move(Register dst, Handle<Object> value) {
2238 mov(dst, value);
2239 }
2240
2241
2242 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { 2260 void MacroAssembler::SetCounter(StatsCounter* counter, int value) {
2243 if (FLAG_native_code_counters && counter->Enabled()) { 2261 if (FLAG_native_code_counters && counter->Enabled()) {
2244 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value)); 2262 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value));
2245 } 2263 }
2246 } 2264 }
2247 2265
2248 2266
2249 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { 2267 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) {
2250 ASSERT(value > 0); 2268 ASSERT(value > 0);
2251 if (FLAG_native_code_counters && counter->Enabled()) { 2269 if (FLAG_native_code_counters && counter->Enabled()) {
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
2711 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); 2729 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset));
2712 Check(less_equal, "Live Bytes Count overflow chunk size"); 2730 Check(less_equal, "Live Bytes Count overflow chunk size");
2713 } 2731 }
2714 2732
2715 bind(&done); 2733 bind(&done);
2716 } 2734 }
2717 2735
2718 } } // namespace v8::internal 2736 } } // namespace v8::internal
2719 2737
2720 #endif // V8_TARGET_ARCH_IA32 2738 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698