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

Side by Side Diff: src/ic-ia32.cc

Issue 39337: Reduced the code sequence for testing for object type.... Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 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/codegen-ia32.cc ('k') | src/macro-assembler-ia32.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 // Helper function used to check that a value is either not a function 124 // Helper function used to check that a value is either not a function
125 // or is loaded if it is a function. 125 // or is loaded if it is a function.
126 static void GenerateCheckNonFunctionOrLoaded(MacroAssembler* masm, Label* miss, 126 static void GenerateCheckNonFunctionOrLoaded(MacroAssembler* masm, Label* miss,
127 Register value, Register scratch) { 127 Register value, Register scratch) {
128 Label done; 128 Label done;
129 // Check if the value is a Smi. 129 // Check if the value is a Smi.
130 __ test(value, Immediate(kSmiTagMask)); 130 __ test(value, Immediate(kSmiTagMask));
131 __ j(zero, &done, not_taken); 131 __ j(zero, &done, not_taken);
132 // Check if the value is a function. 132 // Check if the value is a function.
133 __ mov(scratch, FieldOperand(value, HeapObject::kMapOffset)); 133 __ CmpObjectType(value, JS_FUNCTION_TYPE, scratch);
134 __ movzx_b(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset));
135 __ cmp(scratch, JS_FUNCTION_TYPE);
136 __ j(not_equal, &done, taken); 134 __ j(not_equal, &done, taken);
137 // Check if the function has been loaded. 135 // Check if the function has been loaded.
138 __ mov(scratch, FieldOperand(value, JSFunction::kSharedFunctionInfoOffset)); 136 __ mov(scratch, FieldOperand(value, JSFunction::kSharedFunctionInfoOffset));
139 __ mov(scratch, 137 __ mov(scratch,
140 FieldOperand(scratch, SharedFunctionInfo::kLazyLoadDataOffset)); 138 FieldOperand(scratch, SharedFunctionInfo::kLazyLoadDataOffset));
141 __ cmp(scratch, Factory::undefined_value()); 139 __ cmp(scratch, Factory::undefined_value());
142 __ j(not_equal, miss, not_taken); 140 __ j(not_equal, miss, not_taken);
143 __ bind(&done); 141 __ bind(&done);
144 } 142 }
145 143
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 StubCache::GenerateProbe(masm, flags, edx, ecx, ebx); 432 StubCache::GenerateProbe(masm, flags, edx, ecx, ebx);
435 433
436 // If the stub cache probing failed, the receiver might be a value. 434 // If the stub cache probing failed, the receiver might be a value.
437 // For value objects, we use the map of the prototype objects for 435 // For value objects, we use the map of the prototype objects for
438 // the corresponding JSValue for the cache and that is what we need 436 // the corresponding JSValue for the cache and that is what we need
439 // to probe. 437 // to probe.
440 // 438 //
441 // Check for number. 439 // Check for number.
442 __ test(edx, Immediate(kSmiTagMask)); 440 __ test(edx, Immediate(kSmiTagMask));
443 __ j(zero, &number, not_taken); 441 __ j(zero, &number, not_taken);
444 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); 442 __ CmpObjectType(edx, HEAP_NUMBER_TYPE, ebx);
445 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset));
446 __ cmp(ebx, HEAP_NUMBER_TYPE);
447 __ j(not_equal, &non_number, taken); 443 __ j(not_equal, &non_number, taken);
448 __ bind(&number); 444 __ bind(&number);
449 StubCompiler::GenerateLoadGlobalFunctionPrototype( 445 StubCompiler::GenerateLoadGlobalFunctionPrototype(
450 masm, Context::NUMBER_FUNCTION_INDEX, edx); 446 masm, Context::NUMBER_FUNCTION_INDEX, edx);
451 __ jmp(&probe); 447 __ jmp(&probe);
452 448
453 // Check for string. 449 // Check for string.
454 __ bind(&non_number); 450 __ bind(&non_number);
455 __ cmp(ebx, FIRST_NONSTRING_TYPE); 451 __ cmp(ebx, FIRST_NONSTRING_TYPE);
456 __ j(above_equal, &non_string, taken); 452 __ j(above_equal, &non_string, taken);
(...skipping 27 matching lines...) Expand all
484 Label* miss) { 480 Label* miss) {
485 // Search dictionary - put result in register edx. 481 // Search dictionary - put result in register edx.
486 GenerateDictionaryLoad(masm, miss, eax, edx, ebx, ecx); 482 GenerateDictionaryLoad(masm, miss, eax, edx, ebx, ecx);
487 483
488 // Move the result to register edi and check that it isn't a smi. 484 // Move the result to register edi and check that it isn't a smi.
489 __ mov(edi, Operand(edx)); 485 __ mov(edi, Operand(edx));
490 __ test(edx, Immediate(kSmiTagMask)); 486 __ test(edx, Immediate(kSmiTagMask));
491 __ j(zero, miss, not_taken); 487 __ j(zero, miss, not_taken);
492 488
493 // Check that the value is a JavaScript function. 489 // Check that the value is a JavaScript function.
494 __ mov(edx, FieldOperand(edx, HeapObject::kMapOffset)); 490 __ CmpObjectType(edx, JS_FUNCTION_TYPE, edx);
495 __ movzx_b(edx, FieldOperand(edx, Map::kInstanceTypeOffset));
496 __ cmp(edx, JS_FUNCTION_TYPE);
497 __ j(not_equal, miss, not_taken); 491 __ j(not_equal, miss, not_taken);
498 492
499 // Check that the function has been loaded. 493 // Check that the function has been loaded.
500 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 494 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
501 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kLazyLoadDataOffset)); 495 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kLazyLoadDataOffset));
502 __ cmp(edx, Factory::undefined_value()); 496 __ cmp(edx, Factory::undefined_value());
503 __ j(not_equal, miss, not_taken); 497 __ j(not_equal, miss, not_taken);
504 498
505 // Patch the receiver with the global proxy if necessary. 499 // Patch the receiver with the global proxy if necessary.
506 if (is_global_object) { 500 if (is_global_object) {
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 883
890 // Do tail-call to runtime routine. 884 // Do tail-call to runtime routine.
891 __ TailCallRuntime( 885 __ TailCallRuntime(
892 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3); 886 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3);
893 } 887 }
894 888
895 #undef __ 889 #undef __
896 890
897 891
898 } } // namespace v8::internal 892 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen-ia32.cc ('k') | src/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698