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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 8318014: Make _CallFunction proxy-aware. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Kevin's comment. Created 9 years, 1 month 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/ia32/builtins-ia32.cc ('k') | src/ia32/debug-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4320 matching lines...) Expand 10 before | Expand all | Expand 10 after
4331 4331
4332 Object* CallFunctionStub::GetCachedValue(Address address) { 4332 Object* CallFunctionStub::GetCachedValue(Address address) {
4333 ASSERT(Memory::uint8_at(address + kPointerSize) == Assembler::kTestEaxByte); 4333 ASSERT(Memory::uint8_at(address + kPointerSize) == Assembler::kTestEaxByte);
4334 // 1 ~ size of the test eax opcode. 4334 // 1 ~ size of the test eax opcode.
4335 Object* cell = Memory::Object_at(address + kPointerSize + 1); 4335 Object* cell = Memory::Object_at(address + kPointerSize + 1);
4336 return JSGlobalPropertyCell::cast(cell)->value(); 4336 return JSGlobalPropertyCell::cast(cell)->value();
4337 } 4337 }
4338 4338
4339 4339
4340 void CallFunctionStub::Generate(MacroAssembler* masm) { 4340 void CallFunctionStub::Generate(MacroAssembler* masm) {
4341 // edi : the function to call
4341 Isolate* isolate = masm->isolate(); 4342 Isolate* isolate = masm->isolate();
4342 Label slow, non_function; 4343 Label slow, non_function;
4343 4344
4344 // The receiver might implicitly be the global object. This is 4345 // The receiver might implicitly be the global object. This is
4345 // indicated by passing the hole as the receiver to the call 4346 // indicated by passing the hole as the receiver to the call
4346 // function stub. 4347 // function stub.
4347 if (ReceiverMightBeImplicit()) { 4348 if (ReceiverMightBeImplicit()) {
4348 Label receiver_ok; 4349 Label receiver_ok;
4349 // Get the receiver from the stack. 4350 // Get the receiver from the stack.
4350 // +1 ~ return address 4351 // +1 ~ return address
4351 __ mov(eax, Operand(esp, (argc_ + 1) * kPointerSize)); 4352 __ mov(eax, Operand(esp, (argc_ + 1) * kPointerSize));
4352 // Call as function is indicated with the hole. 4353 // Call as function is indicated with the hole.
4353 __ cmp(eax, isolate->factory()->the_hole_value()); 4354 __ cmp(eax, isolate->factory()->the_hole_value());
4354 __ j(not_equal, &receiver_ok, Label::kNear); 4355 __ j(not_equal, &receiver_ok, Label::kNear);
4355 // Patch the receiver on the stack with the global receiver object. 4356 // Patch the receiver on the stack with the global receiver object.
4356 __ mov(ebx, GlobalObjectOperand()); 4357 __ mov(ebx, GlobalObjectOperand());
4357 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); 4358 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset));
4358 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), ebx); 4359 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), ebx);
4359 __ bind(&receiver_ok); 4360 __ bind(&receiver_ok);
4360 } 4361 }
4361 4362
4362 // Get the function to call from the stack.
4363 // +2 ~ receiver, return address
4364 __ mov(edi, Operand(esp, (argc_ + 2) * kPointerSize));
4365
4366 // Check that the function really is a JavaScript function. 4363 // Check that the function really is a JavaScript function.
4367 __ JumpIfSmi(edi, &non_function); 4364 __ JumpIfSmi(edi, &non_function);
4368 // Goto slow case if we do not have a function. 4365 // Goto slow case if we do not have a function.
4369 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); 4366 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
4370 __ j(not_equal, &slow); 4367 __ j(not_equal, &slow);
4371 4368
4372 if (RecordCallTarget()) { 4369 if (RecordCallTarget()) {
4373 // Cache the called function in a global property cell in the 4370 // Cache the called function in a global property cell in the
4374 // instruction stream after the call. Cache states are uninitialized, 4371 // instruction stream after the call. Cache states are uninitialized,
4375 // monomorphic (indicated by a JSFunction), and megamorphic. 4372 // monomorphic (indicated by a JSFunction), and megamorphic.
(...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after
7247 // Restore registers. 7244 // Restore registers.
7248 __ pop(eax); 7245 __ pop(eax);
7249 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 7246 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
7250 } 7247 }
7251 7248
7252 #undef __ 7249 #undef __
7253 7250
7254 } } // namespace v8::internal 7251 } } // namespace v8::internal
7255 7252
7256 #endif // V8_TARGET_ARCH_IA32 7253 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/ia32/debug-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698