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

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 22267005: Use StackArgumenstAccessor and kPCOnStackSize/kFPOnStackSize to compute stack address/operand (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased with bleeding_edge Created 7 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
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 // If the object is not a JSObject or we got an unexpected number of 2191 // If the object is not a JSObject or we got an unexpected number of
2192 // arguments, bail out to the regular call. 2192 // arguments, bail out to the regular call.
2193 const int argc = arguments().immediate(); 2193 const int argc = arguments().immediate();
2194 StackArgumentsAccessor args(rsp, argc); 2194 StackArgumentsAccessor args(rsp, argc);
2195 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); 2195 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null();
2196 2196
2197 Label miss; 2197 Label miss;
2198 GenerateNameCheck(name, &miss); 2198 GenerateNameCheck(name, &miss);
2199 2199
2200 if (cell.is_null()) { 2200 if (cell.is_null()) {
2201 __ movq(rdx, args.GetArgumentOperand(argc - 1)); 2201 __ movq(rdx, args.GetReceiverOperand());
2202 __ JumpIfSmi(rdx, &miss); 2202 __ JumpIfSmi(rdx, &miss);
2203 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, 2203 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi,
2204 name, &miss); 2204 name, &miss);
2205 } else { 2205 } else {
2206 ASSERT(cell->value() == *function); 2206 ASSERT(cell->value() == *function);
2207 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, 2207 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
2208 &miss); 2208 &miss);
2209 GenerateLoadFunctionFromCell(cell, function, &miss); 2209 GenerateLoadFunctionFromCell(cell, function, &miss);
2210 } 2210 }
2211 2211
2212 // Load the char code argument. 2212 // Load the char code argument.
2213 Register code = rbx; 2213 Register code = rbx;
2214 __ movq(code, args.GetArgumentOperand(argc)); 2214 __ movq(code, args.GetArgumentOperand(1));
2215 2215
2216 // Check the code is a smi. 2216 // Check the code is a smi.
2217 Label slow; 2217 Label slow;
2218 __ JumpIfNotSmi(code, &slow); 2218 __ JumpIfNotSmi(code, &slow);
2219 2219
2220 // Convert the smi code to uint16. 2220 // Convert the smi code to uint16.
2221 __ SmiAndConstant(code, code, Smi::FromInt(0xffff)); 2221 __ SmiAndConstant(code, code, Smi::FromInt(0xffff));
2222 2222
2223 StringCharFromCodeGenerator generator(code, rax); 2223 StringCharFromCodeGenerator generator(code, rax);
2224 generator.GenerateFast(masm()); 2224 generator.GenerateFast(masm());
(...skipping 29 matching lines...) Expand all
2254 Handle<String> name, 2254 Handle<String> name,
2255 Code::StubType type) { 2255 Code::StubType type) {
2256 // ----------- S t a t e ------------- 2256 // ----------- S t a t e -------------
2257 // -- rcx : name 2257 // -- rcx : name
2258 // -- rsp[0] : return address 2258 // -- rsp[0] : return address
2259 // -- rsp[(argc - n) * 4] : arg[n] (zero-based) 2259 // -- rsp[(argc - n) * 4] : arg[n] (zero-based)
2260 // -- ... 2260 // -- ...
2261 // -- rsp[(argc + 1) * 4] : receiver 2261 // -- rsp[(argc + 1) * 4] : receiver
2262 // ----------------------------------- 2262 // -----------------------------------
2263 const int argc = arguments().immediate(); 2263 const int argc = arguments().immediate();
2264 StackArgumentsAccessor args(rsp, argc);
2264 2265
2265 // If the object is not a JSObject or we got an unexpected number of 2266 // If the object is not a JSObject or we got an unexpected number of
2266 // arguments, bail out to the regular call. 2267 // arguments, bail out to the regular call.
2267 if (!object->IsJSObject() || argc != 1) { 2268 if (!object->IsJSObject() || argc != 1) {
2268 return Handle<Code>::null(); 2269 return Handle<Code>::null();
2269 } 2270 }
2270 2271
2271 Label miss; 2272 Label miss;
2272 GenerateNameCheck(name, &miss); 2273 GenerateNameCheck(name, &miss);
2273 2274
2274 if (cell.is_null()) { 2275 if (cell.is_null()) {
2275 __ movq(rdx, Operand(rsp, 2 * kPointerSize)); 2276 __ movq(rdx, args.GetReceiverOperand());
2276 2277
2277 STATIC_ASSERT(kSmiTag == 0); 2278 STATIC_ASSERT(kSmiTag == 0);
2278 __ JumpIfSmi(rdx, &miss); 2279 __ JumpIfSmi(rdx, &miss);
2279 2280
2280 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, 2281 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi,
2281 name, &miss); 2282 name, &miss);
2282 } else { 2283 } else {
2283 ASSERT(cell->value() == *function); 2284 ASSERT(cell->value() == *function);
2284 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, 2285 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
2285 &miss); 2286 &miss);
2286 GenerateLoadFunctionFromCell(cell, function, &miss); 2287 GenerateLoadFunctionFromCell(cell, function, &miss);
2287 } 2288 }
2288 2289
2289 // Load the (only) argument into rax. 2290 // Load the (only) argument into rax.
2290 __ movq(rax, Operand(rsp, 1 * kPointerSize)); 2291 __ movq(rax, args.GetArgumentOperand(1));
2291 2292
2292 // Check if the argument is a smi. 2293 // Check if the argument is a smi.
2293 Label smi; 2294 Label smi;
2294 STATIC_ASSERT(kSmiTag == 0); 2295 STATIC_ASSERT(kSmiTag == 0);
2295 __ JumpIfSmi(rax, &smi); 2296 __ JumpIfSmi(rax, &smi);
2296 2297
2297 // Check if the argument is a heap number and load its value into xmm0. 2298 // Check if the argument is a heap number and load its value into xmm0.
2298 Label slow; 2299 Label slow;
2299 __ CheckMap(rax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); 2300 __ CheckMap(rax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK);
2300 __ movsd(xmm0, FieldOperand(rax, HeapNumber::kValueOffset)); 2301 __ movsd(xmm0, FieldOperand(rax, HeapNumber::kValueOffset));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 __ andpd(xmm1, xmm2); 2348 __ andpd(xmm1, xmm2);
2348 __ subsd(xmm0, xmm1); 2349 __ subsd(xmm0, xmm1);
2349 2350
2350 // Return a new heap number. 2351 // Return a new heap number.
2351 __ AllocateHeapNumber(rax, rbx, &slow); 2352 __ AllocateHeapNumber(rax, rbx, &slow);
2352 __ movsd(FieldOperand(rax, HeapNumber::kValueOffset), xmm0); 2353 __ movsd(FieldOperand(rax, HeapNumber::kValueOffset), xmm0);
2353 __ ret(2 * kPointerSize); 2354 __ ret(2 * kPointerSize);
2354 2355
2355 // Return the argument (when it's an already round heap number). 2356 // Return the argument (when it's an already round heap number).
2356 __ bind(&already_round); 2357 __ bind(&already_round);
2357 __ movq(rax, Operand(rsp, 1 * kPointerSize)); 2358 __ movq(rax, args.GetArgumentOperand(argc));
2358 __ ret(2 * kPointerSize); 2359 __ ret(2 * kPointerSize);
2359 2360
2360 // Tail call the full function. We do not have to patch the receiver 2361 // Tail call the full function. We do not have to patch the receiver
2361 // because the function makes no use of it. 2362 // because the function makes no use of it.
2362 __ bind(&slow); 2363 __ bind(&slow);
2363 ParameterCount expected(function); 2364 ParameterCount expected(function);
2364 __ InvokeFunction(function, expected, arguments(), 2365 __ InvokeFunction(function, expected, arguments(),
2365 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); 2366 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2366 2367
2367 __ bind(&miss); 2368 __ bind(&miss);
(...skipping 23 matching lines...) Expand all
2391 // If the object is not a JSObject or we got an unexpected number of 2392 // If the object is not a JSObject or we got an unexpected number of
2392 // arguments, bail out to the regular call. 2393 // arguments, bail out to the regular call.
2393 const int argc = arguments().immediate(); 2394 const int argc = arguments().immediate();
2394 StackArgumentsAccessor args(rsp, argc); 2395 StackArgumentsAccessor args(rsp, argc);
2395 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); 2396 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null();
2396 2397
2397 Label miss; 2398 Label miss;
2398 GenerateNameCheck(name, &miss); 2399 GenerateNameCheck(name, &miss);
2399 2400
2400 if (cell.is_null()) { 2401 if (cell.is_null()) {
2401 __ movq(rdx, args.GetArgumentOperand(argc - 1)); 2402 __ movq(rdx, args.GetReceiverOperand());
2402 __ JumpIfSmi(rdx, &miss); 2403 __ JumpIfSmi(rdx, &miss);
2403 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, 2404 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi,
2404 name, &miss); 2405 name, &miss);
2405 } else { 2406 } else {
2406 ASSERT(cell->value() == *function); 2407 ASSERT(cell->value() == *function);
2407 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, 2408 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
2408 &miss); 2409 &miss);
2409 GenerateLoadFunctionFromCell(cell, function, &miss); 2410 GenerateLoadFunctionFromCell(cell, function, &miss);
2410 } 2411 }
2411 // Load the (only) argument into rax. 2412 // Load the (only) argument into rax.
2412 __ movq(rax, args.GetArgumentOperand(argc)); 2413 __ movq(rax, args.GetArgumentOperand(1));
2413 2414
2414 // Check if the argument is a smi. 2415 // Check if the argument is a smi.
2415 Label not_smi; 2416 Label not_smi;
2416 STATIC_ASSERT(kSmiTag == 0); 2417 STATIC_ASSERT(kSmiTag == 0);
2417 __ JumpIfNotSmi(rax, &not_smi); 2418 __ JumpIfNotSmi(rax, &not_smi);
2418 2419
2419 // Branchless abs implementation, refer to below: 2420 // Branchless abs implementation, refer to below:
2420 // http://graphics.stanford.edu/~seander/bithacks.html#IntegerAbs 2421 // http://graphics.stanford.edu/~seander/bithacks.html#IntegerAbs
2421 // Set ebx to 1...1 (== -1) if the argument is negative, or to 0...0 2422 // Set ebx to 1...1 (== -1) if the argument is negative, or to 0...0
2422 // otherwise. 2423 // otherwise.
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
3177 // ----------------------------------- 3178 // -----------------------------------
3178 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3179 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3179 } 3180 }
3180 3181
3181 3182
3182 #undef __ 3183 #undef __
3183 3184
3184 } } // namespace v8::internal 3185 } } // namespace v8::internal
3185 3186
3186 #endif // V8_TARGET_ARCH_X64 3187 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698