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

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

Issue 159266: Add inline caching for keyed loads and stores. Remove extra parentheses from... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 5 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.h ('k') | test/cctest/cctest.status » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 JSObject* holder, 320 JSObject* holder,
321 Object* value, 321 Object* value,
322 String* name) { 322 String* name) {
323 // ----------- S t a t e ------------- 323 // ----------- S t a t e -------------
324 // -- rcx : name 324 // -- rcx : name
325 // -- rsp[0] : return address 325 // -- rsp[0] : return address
326 // -- rsp[8] : receiver 326 // -- rsp[8] : receiver
327 // ----------------------------------- 327 // -----------------------------------
328 Label miss; 328 Label miss;
329 329
330 __ movq(rax, (Operand(rsp, kPointerSize))); 330 __ movq(rax, Operand(rsp, kPointerSize));
331 GenerateLoadConstant(object, holder, rax, rbx, rdx, value, name, &miss); 331 GenerateLoadConstant(object, holder, rax, rbx, rdx, value, name, &miss);
332 __ bind(&miss); 332 __ bind(&miss);
333 GenerateLoadMiss(masm(), Code::LOAD_IC); 333 GenerateLoadMiss(masm(), Code::LOAD_IC);
334 334
335 // Return the generated code. 335 // Return the generated code.
336 return GetCode(CONSTANT_FUNCTION, name); 336 return GetCode(CONSTANT_FUNCTION, name);
337 } 337 }
338 338
339 339
340 Object* LoadStubCompiler::CompileLoadField(JSObject* object, 340 Object* LoadStubCompiler::CompileLoadField(JSObject* object,
341 JSObject* holder, 341 JSObject* holder,
342 int index, 342 int index,
343 String* name) { 343 String* name) {
344 // ----------- S t a t e ------------- 344 // ----------- S t a t e -------------
345 // -- rcx : name 345 // -- rcx : name
346 // -- rsp[0] : return address 346 // -- rsp[0] : return address
347 // -- rsp[8] : receiver 347 // -- rsp[8] : receiver
348 // ----------------------------------- 348 // -----------------------------------
349 Label miss; 349 Label miss;
350 350
351 __ movq(rax, (Operand(rsp, kPointerSize))); 351 __ movq(rax, Operand(rsp, kPointerSize));
352 GenerateLoadField(object, holder, rax, rbx, rdx, index, name, &miss); 352 GenerateLoadField(object, holder, rax, rbx, rdx, index, name, &miss);
353 __ bind(&miss); 353 __ bind(&miss);
354 GenerateLoadMiss(masm(), Code::LOAD_IC); 354 GenerateLoadMiss(masm(), Code::LOAD_IC);
355 355
356 // Return the generated code. 356 // Return the generated code.
357 return GetCode(FIELD, name); 357 return GetCode(FIELD, name);
358 } 358 }
359 359
360 360
361 Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* a, 361 Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* a,
(...skipping 12 matching lines...) Expand all
374 // ----------- S t a t e ------------- 374 // ----------- S t a t e -------------
375 // -- rcx : name 375 // -- rcx : name
376 // -- rsp[0] : return address 376 // -- rsp[0] : return address
377 // -- rsp[8] : receiver 377 // -- rsp[8] : receiver
378 // ----------------------------------- 378 // -----------------------------------
379 Label miss; 379 Label miss;
380 380
381 __ IncrementCounter(&Counters::named_load_global_inline, 1); 381 __ IncrementCounter(&Counters::named_load_global_inline, 1);
382 382
383 // Get the receiver from the stack. 383 // Get the receiver from the stack.
384 __ movq(rax, (Operand(rsp, kPointerSize))); 384 __ movq(rax, Operand(rsp, kPointerSize));
385 385
386 // If the object is the holder then we know that it's a global 386 // If the object is the holder then we know that it's a global
387 // object which can only happen for contextual loads. In this case, 387 // object which can only happen for contextual loads. In this case,
388 // the receiver cannot be a smi. 388 // the receiver cannot be a smi.
389 if (object != holder) { 389 if (object != holder) {
390 __ testl(rax, Immediate(kSmiTagMask)); 390 __ testl(rax, Immediate(kSmiTagMask));
391 __ j(zero, &miss); 391 __ j(zero, &miss);
392 } 392 }
393 393
394 // Check that the maps haven't changed. 394 // Check that the maps haven't changed.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 469
470 470
471 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, 471 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object,
472 JSGlobalPropertyCell* cell, 472 JSGlobalPropertyCell* cell,
473 String* name) { 473 String* name) {
474 UNIMPLEMENTED(); 474 UNIMPLEMENTED();
475 return NULL; 475 return NULL;
476 } 476 }
477 477
478 478
479 Object* KeyedLoadStubCompiler::CompileLoadField(String* name,
480 JSObject* receiver,
481 JSObject* holder,
482 int index) {
483 // ----------- S t a t e -------------
484 // -- rsp[0] : return address
485 // -- rsp[8] : name
486 // -- rsp[16] : receiver
487 // -----------------------------------
488 Label miss;
489
490 __ movq(rax, Operand(rsp, kPointerSize));
491 __ movq(rcx, Operand(rsp, 2 * kPointerSize));
492 __ IncrementCounter(&Counters::keyed_load_field, 1);
493
494 // Check that the name has not changed.
495 __ Cmp(rax, Handle<String>(name));
496 __ j(not_equal, &miss);
497
498 GenerateLoadField(receiver, holder, rcx, rbx, rdx, index, name, &miss);
499
500 __ bind(&miss);
501 __ DecrementCounter(&Counters::keyed_load_field, 1);
502 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
503
504 // Return the generated code.
505 return GetCode(FIELD, name);
506 }
507
508
479 // TODO(1241006): Avoid having lazy compile stubs specialized by the 509 // TODO(1241006): Avoid having lazy compile stubs specialized by the
480 // number of arguments. It is not needed anymore. 510 // number of arguments. It is not needed anymore.
481 Object* StubCompiler::CompileLazyCompile(Code::Flags flags) { 511 Object* StubCompiler::CompileLazyCompile(Code::Flags flags) {
482 // Enter an internal frame. 512 // Enter an internal frame.
483 __ EnterInternalFrame(); 513 __ EnterInternalFrame();
484 514
485 // Push a copy of the function onto the stack. 515 // Push a copy of the function onto the stack.
486 __ push(rdi); 516 __ push(rdi);
487 517
488 __ push(rdi); // function is also the parameter to the runtime call 518 __ push(rdi); // function is also the parameter to the runtime call
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 828
799 // Return the value (register rax). 829 // Return the value (register rax).
800 __ ret(0); 830 __ ret(0);
801 } 831 }
802 832
803 833
804 #undef __ 834 #undef __
805 835
806 836
807 } } // namespace v8::internal 837 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698