Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 #else | 517 #else |
| 518 Register arguments_arg = rdi; | 518 Register arguments_arg = rdi; |
| 519 Register callback_arg = rsi; | 519 Register callback_arg = rsi; |
| 520 #endif | 520 #endif |
| 521 | 521 |
| 522 // v8::InvocationCallback's argument. | 522 // v8::InvocationCallback's argument. |
| 523 __ lea(arguments_arg, StackSpaceOperand(0)); | 523 __ lea(arguments_arg, StackSpaceOperand(0)); |
| 524 | 524 |
| 525 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); | 525 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); |
| 526 | 526 |
| 527 Operand context_restore_operand(rbp, 2 * kPointerSize); | 527 StackArgumentsAccessor args_from_rbp(rbp, kFastApiCallArguments, |
|
haitao.feng
2013/09/22 09:44:28
Line 527 to 538 needs review.
| |
| 528 Operand return_value_operand( | 528 ARGUMENTS_DONT_CONTAIN_RECEIVER); |
| 529 rbp, (kFastApiCallArguments + 1) * kPointerSize); | 529 Operand context_restore_operand = args_from_rbp.GetArgumentOperand( |
| 530 -FunctionCallbackArguments::kContextSaveIndex); | |
| 531 Operand return_value_operand = args_from_rbp.GetArgumentOperand(0); | |
| 530 __ CallApiFunctionAndReturn(function_address, | 532 __ CallApiFunctionAndReturn(function_address, |
| 531 thunk_address, | 533 thunk_address, |
| 532 callback_arg, | 534 callback_arg, |
| 533 api_call_argc + 1, | 535 api_call_argc + 1, |
| 534 return_value_operand, | 536 return_value_operand, |
| 535 restore_context ? | 537 restore_context ? |
| 536 &context_restore_operand : NULL); | 538 &context_restore_operand : NULL); |
| 537 } | 539 } |
| 538 | 540 |
| 539 | 541 |
| 540 // Generate call to api function. | 542 // Generate call to api function. |
| 541 static void GenerateFastApiCall(MacroAssembler* masm, | 543 static void GenerateFastApiCall(MacroAssembler* masm, |
| 542 const CallOptimization& optimization, | 544 const CallOptimization& optimization, |
| 543 Register receiver, | 545 Register receiver, |
| 544 Register scratch, | 546 Register scratch, |
| 545 int argc, | 547 int argc, |
| 546 Register* values) { | 548 Register* values) { |
| 547 ASSERT(optimization.is_simple_api_call()); | 549 ASSERT(optimization.is_simple_api_call()); |
| 548 ASSERT(!receiver.is(scratch)); | 550 ASSERT(!receiver.is(scratch)); |
| 549 | 551 |
| 550 const int stack_space = kFastApiCallArguments + argc + 1; | 552 int fast_api_call_argc = argc + kFastApiCallArguments; |
| 551 const int kHolderIndex = kFastApiCallArguments + | 553 StackArgumentsAccessor args(rsp, fast_api_call_argc); |
| 552 FunctionCallbackArguments::kHolderIndex; | 554 |
| 553 // Copy return value. | 555 __ movq(scratch, StackOperandForReturnAddress(0)); |
| 554 __ movq(scratch, Operand(rsp, 0)); | 556 // Assign stack space for the call arguments and receiver. |
| 555 // Assign stack space for the call arguments. | 557 __ subq(rsp, Immediate((fast_api_call_argc + 1) * kPointerSize)); |
| 556 __ subq(rsp, Immediate(stack_space * kPointerSize)); | 558 __ movq(StackOperandForReturnAddress(0), scratch); |
| 557 // Move the return address on top of the stack. | |
| 558 __ movq(Operand(rsp, 0), scratch); | |
| 559 // Write holder to stack frame. | 559 // Write holder to stack frame. |
| 560 __ movq(Operand(rsp, kHolderIndex * kPointerSize), receiver); | 560 __ movq(args.GetArgumentOperand(fast_api_call_argc - 1), receiver); |
| 561 // Write receiver to stack frame. | 561 __ movq(args.GetReceiverOperand(), receiver); |
| 562 int index = stack_space; | |
| 563 __ movq(Operand(rsp, index-- * kPointerSize), receiver); | |
| 564 // Write the arguments to stack frame. | 562 // Write the arguments to stack frame. |
| 565 for (int i = 0; i < argc; i++) { | 563 for (int i = 0; i < argc; i++) { |
| 566 ASSERT(!receiver.is(values[i])); | 564 ASSERT(!receiver.is(values[i])); |
| 567 ASSERT(!scratch.is(values[i])); | 565 ASSERT(!scratch.is(values[i])); |
| 568 __ movq(Operand(rsp, index-- * kPointerSize), values[i]); | 566 __ movq(args.GetArgumentOperand(i + 1), values[i]); |
| 569 } | 567 } |
| 570 | 568 |
| 571 GenerateFastApiCall(masm, optimization, argc, true); | 569 GenerateFastApiCall(masm, optimization, argc, true); |
| 572 } | 570 } |
| 573 | 571 |
| 574 | 572 |
| 575 class CallInterceptorCompiler BASE_EMBEDDED { | 573 class CallInterceptorCompiler BASE_EMBEDDED { |
| 576 public: | 574 public: |
| 577 CallInterceptorCompiler(StubCompiler* stub_compiler, | 575 CallInterceptorCompiler(StubCompiler* stub_compiler, |
| 578 const ParameterCount& arguments, | 576 const ParameterCount& arguments, |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1091 Register StubCompiler::CheckPrototypes(Handle<JSObject> object, | 1089 Register StubCompiler::CheckPrototypes(Handle<JSObject> object, |
| 1092 Register object_reg, | 1090 Register object_reg, |
| 1093 Handle<JSObject> holder, | 1091 Handle<JSObject> holder, |
| 1094 Register holder_reg, | 1092 Register holder_reg, |
| 1095 Register scratch1, | 1093 Register scratch1, |
| 1096 Register scratch2, | 1094 Register scratch2, |
| 1097 Handle<Name> name, | 1095 Handle<Name> name, |
| 1098 int save_at_depth, | 1096 int save_at_depth, |
| 1099 Label* miss, | 1097 Label* miss, |
| 1100 PrototypeCheckType check) { | 1098 PrototypeCheckType check) { |
| 1101 const int kHolderIndex = kFastApiCallArguments + | |
| 1102 FunctionCallbackArguments::kHolderIndex; | |
| 1103 // Make sure that the type feedback oracle harvests the receiver map. | 1099 // Make sure that the type feedback oracle harvests the receiver map. |
| 1104 // TODO(svenpanne) Remove this hack when all ICs are reworked. | 1100 // TODO(svenpanne) Remove this hack when all ICs are reworked. |
| 1105 __ Move(scratch1, Handle<Map>(object->map())); | 1101 __ Move(scratch1, Handle<Map>(object->map())); |
| 1106 | 1102 |
| 1107 Handle<JSObject> first = object; | 1103 Handle<JSObject> first = object; |
| 1108 // Make sure there's no overlap between holder and object registers. | 1104 // Make sure there's no overlap between holder and object registers. |
| 1109 ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); | 1105 ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); |
| 1110 ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg) | 1106 ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg) |
| 1111 && !scratch2.is(scratch1)); | 1107 && !scratch2.is(scratch1)); |
| 1112 | 1108 |
| 1113 // Keep track of the current object in register reg. On the first | 1109 // Keep track of the current object in register reg. On the first |
| 1114 // iteration, reg is an alias for object_reg, on later iterations, | 1110 // iteration, reg is an alias for object_reg, on later iterations, |
| 1115 // it is an alias for holder_reg. | 1111 // it is an alias for holder_reg. |
| 1116 Register reg = object_reg; | 1112 Register reg = object_reg; |
| 1117 int depth = 0; | 1113 int depth = 0; |
| 1118 | 1114 |
| 1115 StackArgumentsAccessor args(rsp, kFastApiCallArguments, | |
|
haitao.feng
2013/09/22 09:44:28
This needs review.
| |
| 1116 ARGUMENTS_DONT_CONTAIN_RECEIVER); | |
| 1119 if (save_at_depth == depth) { | 1117 if (save_at_depth == depth) { |
| 1120 __ movq(Operand(rsp, kHolderIndex * kPointerSize), object_reg); | 1118 __ movq(args.GetArgumentOperand(-FunctionCallbackArguments::kHolderIndex), |
| 1119 object_reg); | |
| 1121 } | 1120 } |
| 1122 | 1121 |
| 1123 // Check the maps in the prototype chain. | 1122 // Check the maps in the prototype chain. |
| 1124 // Traverse the prototype chain from the object and do map checks. | 1123 // Traverse the prototype chain from the object and do map checks. |
| 1125 Handle<JSObject> current = object; | 1124 Handle<JSObject> current = object; |
| 1126 while (!current.is_identical_to(holder)) { | 1125 while (!current.is_identical_to(holder)) { |
| 1127 ++depth; | 1126 ++depth; |
| 1128 | 1127 |
| 1129 // Only global objects and objects that do not require access | 1128 // Only global objects and objects that do not require access |
| 1130 // checks are allowed in stubs. | 1129 // checks are allowed in stubs. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1170 // The prototype is in new space; we cannot store a reference to it | 1169 // The prototype is in new space; we cannot store a reference to it |
| 1171 // in the code. Load it from the map. | 1170 // in the code. Load it from the map. |
| 1172 __ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 1171 __ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
| 1173 } else { | 1172 } else { |
| 1174 // The prototype is in old space; load it directly. | 1173 // The prototype is in old space; load it directly. |
| 1175 __ Move(reg, prototype); | 1174 __ Move(reg, prototype); |
| 1176 } | 1175 } |
| 1177 } | 1176 } |
| 1178 | 1177 |
| 1179 if (save_at_depth == depth) { | 1178 if (save_at_depth == depth) { |
| 1180 __ movq(Operand(rsp, kHolderIndex * kPointerSize), reg); | 1179 __ movq(args.GetArgumentOperand(-FunctionCallbackArguments::kHolderIndex), |
| 1180 reg); | |
| 1181 } | 1181 } |
| 1182 | 1182 |
| 1183 // Go to the next object in the prototype chain. | 1183 // Go to the next object in the prototype chain. |
| 1184 current = prototype; | 1184 current = prototype; |
| 1185 } | 1185 } |
| 1186 ASSERT(current.is_identical_to(holder)); | 1186 ASSERT(current.is_identical_to(holder)); |
| 1187 | 1187 |
| 1188 // Log the check depth. | 1188 // Log the check depth. |
| 1189 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); | 1189 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); |
| 1190 | 1190 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1388 | 1388 |
| 1389 // v8::AccessorInfo::args_. | 1389 // v8::AccessorInfo::args_. |
| 1390 __ movq(StackSpaceOperand(0), rax); | 1390 __ movq(StackSpaceOperand(0), rax); |
| 1391 | 1391 |
| 1392 // The context register (rsi) has been saved in PrepareCallApiFunction and | 1392 // The context register (rsi) has been saved in PrepareCallApiFunction and |
| 1393 // could be used to pass arguments. | 1393 // could be used to pass arguments. |
| 1394 __ lea(accessor_info_arg, StackSpaceOperand(0)); | 1394 __ lea(accessor_info_arg, StackSpaceOperand(0)); |
| 1395 | 1395 |
| 1396 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); | 1396 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); |
| 1397 | 1397 |
| 1398 // The name handler is counted as an argument. | |
|
haitao.feng
2013/09/22 09:44:28
Line 1398 to 1407 need review.
| |
| 1399 StackArgumentsAccessor args(rbp, PropertyCallbackArguments::kArgsLength); | |
| 1400 Operand return_value_operand = args.GetArgumentOperand( | |
| 1401 -PropertyCallbackArguments::kReturnValueOffset); | |
| 1398 __ CallApiFunctionAndReturn(getter_address, | 1402 __ CallApiFunctionAndReturn(getter_address, |
| 1399 thunk_address, | 1403 thunk_address, |
| 1400 getter_arg, | 1404 getter_arg, |
| 1401 kStackSpace, | 1405 kStackSpace, |
| 1402 Operand(rbp, 6 * kPointerSize), | 1406 return_value_operand, |
| 1403 NULL); | 1407 NULL); |
| 1404 } | 1408 } |
| 1405 | 1409 |
| 1406 | 1410 |
| 1407 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { | 1411 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 1408 // Return the constant value. | 1412 // Return the constant value. |
| 1409 __ LoadObject(rax, value); | 1413 __ LoadObject(rax, value); |
| 1410 __ ret(0); | 1414 __ ret(0); |
| 1411 } | 1415 } |
| 1412 | 1416 |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2186 // If the object is not a JSObject or we got an unexpected number of | 2190 // If the object is not a JSObject or we got an unexpected number of |
| 2187 // arguments, bail out to the regular call. | 2191 // arguments, bail out to the regular call. |
| 2188 const int argc = arguments().immediate(); | 2192 const int argc = arguments().immediate(); |
| 2189 StackArgumentsAccessor args(rsp, argc); | 2193 StackArgumentsAccessor args(rsp, argc); |
| 2190 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); | 2194 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); |
| 2191 | 2195 |
| 2192 Label miss; | 2196 Label miss; |
| 2193 GenerateNameCheck(name, &miss); | 2197 GenerateNameCheck(name, &miss); |
| 2194 | 2198 |
| 2195 if (cell.is_null()) { | 2199 if (cell.is_null()) { |
| 2196 __ movq(rdx, args.GetArgumentOperand(argc - 1)); | 2200 __ movq(rdx, args.GetReceiverOperand()); |
| 2197 __ JumpIfSmi(rdx, &miss); | 2201 __ JumpIfSmi(rdx, &miss); |
| 2198 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, | 2202 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, |
| 2199 name, &miss); | 2203 name, &miss); |
| 2200 } else { | 2204 } else { |
| 2201 ASSERT(cell->value() == *function); | 2205 ASSERT(cell->value() == *function); |
| 2202 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, | 2206 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, |
| 2203 &miss); | 2207 &miss); |
| 2204 GenerateLoadFunctionFromCell(cell, function, &miss); | 2208 GenerateLoadFunctionFromCell(cell, function, &miss); |
| 2205 } | 2209 } |
| 2206 | 2210 |
| 2207 // Load the char code argument. | 2211 // Load the char code argument. |
| 2208 Register code = rbx; | 2212 Register code = rbx; |
| 2209 __ movq(code, args.GetArgumentOperand(argc)); | 2213 __ movq(code, args.GetArgumentOperand(1)); |
| 2210 | 2214 |
| 2211 // Check the code is a smi. | 2215 // Check the code is a smi. |
| 2212 Label slow; | 2216 Label slow; |
| 2213 __ JumpIfNotSmi(code, &slow); | 2217 __ JumpIfNotSmi(code, &slow); |
| 2214 | 2218 |
| 2215 // Convert the smi code to uint16. | 2219 // Convert the smi code to uint16. |
| 2216 __ SmiAndConstant(code, code, Smi::FromInt(0xffff)); | 2220 __ SmiAndConstant(code, code, Smi::FromInt(0xffff)); |
| 2217 | 2221 |
| 2218 StringCharFromCodeGenerator generator(code, rax); | 2222 StringCharFromCodeGenerator generator(code, rax); |
| 2219 generator.GenerateFast(masm()); | 2223 generator.GenerateFast(masm()); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 2249 Handle<String> name, | 2253 Handle<String> name, |
| 2250 Code::StubType type) { | 2254 Code::StubType type) { |
| 2251 // ----------- S t a t e ------------- | 2255 // ----------- S t a t e ------------- |
| 2252 // -- rcx : name | 2256 // -- rcx : name |
| 2253 // -- rsp[0] : return address | 2257 // -- rsp[0] : return address |
| 2254 // -- rsp[(argc - n) * 4] : arg[n] (zero-based) | 2258 // -- rsp[(argc - n) * 4] : arg[n] (zero-based) |
| 2255 // -- ... | 2259 // -- ... |
| 2256 // -- rsp[(argc + 1) * 4] : receiver | 2260 // -- rsp[(argc + 1) * 4] : receiver |
| 2257 // ----------------------------------- | 2261 // ----------------------------------- |
| 2258 const int argc = arguments().immediate(); | 2262 const int argc = arguments().immediate(); |
| 2263 StackArgumentsAccessor args(rsp, argc); | |
| 2259 | 2264 |
| 2260 // If the object is not a JSObject or we got an unexpected number of | 2265 // If the object is not a JSObject or we got an unexpected number of |
| 2261 // arguments, bail out to the regular call. | 2266 // arguments, bail out to the regular call. |
| 2262 if (!object->IsJSObject() || argc != 1) { | 2267 if (!object->IsJSObject() || argc != 1) { |
| 2263 return Handle<Code>::null(); | 2268 return Handle<Code>::null(); |
| 2264 } | 2269 } |
| 2265 | 2270 |
| 2266 Label miss; | 2271 Label miss; |
| 2267 GenerateNameCheck(name, &miss); | 2272 GenerateNameCheck(name, &miss); |
| 2268 | 2273 |
| 2269 if (cell.is_null()) { | 2274 if (cell.is_null()) { |
| 2270 __ movq(rdx, Operand(rsp, 2 * kPointerSize)); | 2275 __ movq(rdx, args.GetReceiverOperand()); |
| 2271 | 2276 |
| 2272 STATIC_ASSERT(kSmiTag == 0); | 2277 STATIC_ASSERT(kSmiTag == 0); |
| 2273 __ JumpIfSmi(rdx, &miss); | 2278 __ JumpIfSmi(rdx, &miss); |
| 2274 | 2279 |
| 2275 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, | 2280 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, |
| 2276 name, &miss); | 2281 name, &miss); |
| 2277 } else { | 2282 } else { |
| 2278 ASSERT(cell->value() == *function); | 2283 ASSERT(cell->value() == *function); |
| 2279 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, | 2284 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, |
| 2280 &miss); | 2285 &miss); |
| 2281 GenerateLoadFunctionFromCell(cell, function, &miss); | 2286 GenerateLoadFunctionFromCell(cell, function, &miss); |
| 2282 } | 2287 } |
| 2283 | 2288 |
| 2284 // Load the (only) argument into rax. | 2289 // Load the (only) argument into rax. |
| 2285 __ movq(rax, Operand(rsp, 1 * kPointerSize)); | 2290 __ movq(rax, args.GetArgumentOperand(1)); |
| 2286 | 2291 |
| 2287 // Check if the argument is a smi. | 2292 // Check if the argument is a smi. |
| 2288 Label smi; | 2293 Label smi; |
| 2289 STATIC_ASSERT(kSmiTag == 0); | 2294 STATIC_ASSERT(kSmiTag == 0); |
| 2290 __ JumpIfSmi(rax, &smi); | 2295 __ JumpIfSmi(rax, &smi); |
| 2291 | 2296 |
| 2292 // Check if the argument is a heap number and load its value into xmm0. | 2297 // Check if the argument is a heap number and load its value into xmm0. |
| 2293 Label slow; | 2298 Label slow; |
| 2294 __ CheckMap(rax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); | 2299 __ CheckMap(rax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); |
| 2295 __ movsd(xmm0, FieldOperand(rax, HeapNumber::kValueOffset)); | 2300 __ movsd(xmm0, FieldOperand(rax, HeapNumber::kValueOffset)); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2342 __ andpd(xmm1, xmm2); | 2347 __ andpd(xmm1, xmm2); |
| 2343 __ subsd(xmm0, xmm1); | 2348 __ subsd(xmm0, xmm1); |
| 2344 | 2349 |
| 2345 // Return a new heap number. | 2350 // Return a new heap number. |
| 2346 __ AllocateHeapNumber(rax, rbx, &slow); | 2351 __ AllocateHeapNumber(rax, rbx, &slow); |
| 2347 __ movsd(FieldOperand(rax, HeapNumber::kValueOffset), xmm0); | 2352 __ movsd(FieldOperand(rax, HeapNumber::kValueOffset), xmm0); |
| 2348 __ ret(2 * kPointerSize); | 2353 __ ret(2 * kPointerSize); |
| 2349 | 2354 |
| 2350 // Return the argument (when it's an already round heap number). | 2355 // Return the argument (when it's an already round heap number). |
| 2351 __ bind(&already_round); | 2356 __ bind(&already_round); |
| 2352 __ movq(rax, Operand(rsp, 1 * kPointerSize)); | 2357 __ movq(rax, args.GetArgumentOperand(argc)); |
| 2353 __ ret(2 * kPointerSize); | 2358 __ ret(2 * kPointerSize); |
| 2354 | 2359 |
| 2355 // Tail call the full function. We do not have to patch the receiver | 2360 // Tail call the full function. We do not have to patch the receiver |
| 2356 // because the function makes no use of it. | 2361 // because the function makes no use of it. |
| 2357 __ bind(&slow); | 2362 __ bind(&slow); |
| 2358 ParameterCount expected(function); | 2363 ParameterCount expected(function); |
| 2359 __ InvokeFunction(function, expected, arguments(), | 2364 __ InvokeFunction(function, expected, arguments(), |
| 2360 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | 2365 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
| 2361 | 2366 |
| 2362 __ bind(&miss); | 2367 __ bind(&miss); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 2386 // If the object is not a JSObject or we got an unexpected number of | 2391 // If the object is not a JSObject or we got an unexpected number of |
| 2387 // arguments, bail out to the regular call. | 2392 // arguments, bail out to the regular call. |
| 2388 const int argc = arguments().immediate(); | 2393 const int argc = arguments().immediate(); |
| 2389 StackArgumentsAccessor args(rsp, argc); | 2394 StackArgumentsAccessor args(rsp, argc); |
| 2390 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); | 2395 if (!object->IsJSObject() || argc != 1) return Handle<Code>::null(); |
| 2391 | 2396 |
| 2392 Label miss; | 2397 Label miss; |
| 2393 GenerateNameCheck(name, &miss); | 2398 GenerateNameCheck(name, &miss); |
| 2394 | 2399 |
| 2395 if (cell.is_null()) { | 2400 if (cell.is_null()) { |
| 2396 __ movq(rdx, args.GetArgumentOperand(argc - 1)); | 2401 __ movq(rdx, args.GetReceiverOperand()); |
| 2397 __ JumpIfSmi(rdx, &miss); | 2402 __ JumpIfSmi(rdx, &miss); |
| 2398 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, | 2403 CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi, |
| 2399 name, &miss); | 2404 name, &miss); |
| 2400 } else { | 2405 } else { |
| 2401 ASSERT(cell->value() == *function); | 2406 ASSERT(cell->value() == *function); |
| 2402 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, | 2407 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name, |
| 2403 &miss); | 2408 &miss); |
| 2404 GenerateLoadFunctionFromCell(cell, function, &miss); | 2409 GenerateLoadFunctionFromCell(cell, function, &miss); |
| 2405 } | 2410 } |
| 2406 // Load the (only) argument into rax. | 2411 // Load the (only) argument into rax. |
| 2407 __ movq(rax, args.GetArgumentOperand(argc)); | 2412 __ movq(rax, args.GetArgumentOperand(1)); |
| 2408 | 2413 |
| 2409 // Check if the argument is a smi. | 2414 // Check if the argument is a smi. |
| 2410 Label not_smi; | 2415 Label not_smi; |
| 2411 STATIC_ASSERT(kSmiTag == 0); | 2416 STATIC_ASSERT(kSmiTag == 0); |
| 2412 __ JumpIfNotSmi(rax, ¬_smi); | 2417 __ JumpIfNotSmi(rax, ¬_smi); |
| 2413 | 2418 |
| 2414 // Branchless abs implementation, refer to below: | 2419 // Branchless abs implementation, refer to below: |
| 2415 // http://graphics.stanford.edu/~seander/bithacks.html#IntegerAbs | 2420 // http://graphics.stanford.edu/~seander/bithacks.html#IntegerAbs |
| 2416 // Set ebx to 1...1 (== -1) if the argument is negative, or to 0...0 | 2421 // Set ebx to 1...1 (== -1) if the argument is negative, or to 0...0 |
| 2417 // otherwise. | 2422 // otherwise. |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3172 // ----------------------------------- | 3177 // ----------------------------------- |
| 3173 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3178 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
| 3174 } | 3179 } |
| 3175 | 3180 |
| 3176 | 3181 |
| 3177 #undef __ | 3182 #undef __ |
| 3178 | 3183 |
| 3179 } } // namespace v8::internal | 3184 } } // namespace v8::internal |
| 3180 | 3185 |
| 3181 #endif // V8_TARGET_ARCH_X64 | 3186 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |