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

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

Issue 39336: Refactored the code for comparing the type of an object with a constant.... Base URL: http://v8.googlecode.com/svn/branches/experimental/global/
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
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Load the map into r0. 63 // Load the map into r0.
64 __ mov(r0, FieldOperand(r1, JSObject::kMapOffset)); 64 __ mov(r0, FieldOperand(r1, JSObject::kMapOffset));
65 // Test the has_named_interceptor bit in the map. 65 // Test the has_named_interceptor bit in the map.
66 __ test(FieldOperand(r0, Map::kInstanceAttributesOffset), 66 __ test(FieldOperand(r0, Map::kInstanceAttributesOffset),
67 Immediate(1 << (Map::kHasNamedInterceptor + (3 * 8)))); 67 Immediate(1 << (Map::kHasNamedInterceptor + (3 * 8))));
68 68
69 // Jump to miss if the interceptor bit is set. 69 // Jump to miss if the interceptor bit is set.
70 __ j(not_zero, miss_label, not_taken); 70 __ j(not_zero, miss_label, not_taken);
71 71
72 // Bail out if we have a JS global object. 72 // Bail out if we have a JS global object.
73 __ movzx_b(r0, FieldOperand(r0, Map::kInstanceTypeOffset)); 73 __ CmpInstanceType(r0, JS_GLOBAL_OBJECT_TYPE);
74 __ cmp(r0, JS_GLOBAL_OBJECT_TYPE);
75 __ j(equal, miss_label, not_taken); 74 __ j(equal, miss_label, not_taken);
76 75
77 // Check that the properties array is a dictionary. 76 // Check that the properties array is a dictionary.
78 __ mov(r0, FieldOperand(r1, JSObject::kPropertiesOffset)); 77 __ mov(r0, FieldOperand(r1, JSObject::kPropertiesOffset));
79 __ cmp(FieldOperand(r0, HeapObject::kMapOffset), 78 __ cmp(FieldOperand(r0, HeapObject::kMapOffset),
80 Immediate(Factory::hash_table_map())); 79 Immediate(Factory::hash_table_map()));
81 __ j(not_equal, miss_label); 80 __ j(not_equal, miss_label);
82 81
83 // Compute the capacity mask. 82 // Compute the capacity mask.
84 const int kCapacityOffset = 83 const int kCapacityOffset =
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 128
130 // Helper function used to check that a value is either not a function 129 // Helper function used to check that a value is either not a function
131 // or is loaded if it is a function. 130 // or is loaded if it is a function.
132 static void GenerateCheckNonFunctionOrLoaded(MacroAssembler* masm, Label* miss, 131 static void GenerateCheckNonFunctionOrLoaded(MacroAssembler* masm, Label* miss,
133 Register value, Register scratch) { 132 Register value, Register scratch) {
134 Label done; 133 Label done;
135 // Check if the value is a Smi. 134 // Check if the value is a Smi.
136 __ test(value, Immediate(kSmiTagMask)); 135 __ test(value, Immediate(kSmiTagMask));
137 __ j(zero, &done, not_taken); 136 __ j(zero, &done, not_taken);
138 // Check if the value is a function. 137 // Check if the value is a function.
139 __ mov(scratch, FieldOperand(value, HeapObject::kMapOffset)); 138 __ CmpObjectType(value, JS_FUNCTION_TYPE, scratch);
140 __ movzx_b(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset));
141 __ cmp(scratch, JS_FUNCTION_TYPE);
142 __ j(not_equal, &done, taken); 139 __ j(not_equal, &done, taken);
143 // Check if the function has been loaded. 140 // Check if the function has been loaded.
144 __ mov(scratch, FieldOperand(value, JSFunction::kSharedFunctionInfoOffset)); 141 __ mov(scratch, FieldOperand(value, JSFunction::kSharedFunctionInfoOffset));
145 __ mov(scratch, 142 __ mov(scratch,
146 FieldOperand(scratch, SharedFunctionInfo::kLazyLoadDataOffset)); 143 FieldOperand(scratch, SharedFunctionInfo::kLazyLoadDataOffset));
147 __ cmp(scratch, Factory::undefined_value()); 144 __ cmp(scratch, Factory::undefined_value());
148 __ j(not_equal, miss, not_taken); 145 __ j(not_equal, miss, not_taken);
149 __ bind(&done); 146 __ bind(&done);
150 } 147 }
151 148
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 StubCache::GenerateProbe(masm, flags, edx, ecx, ebx); 437 StubCache::GenerateProbe(masm, flags, edx, ecx, ebx);
441 438
442 // If the stub cache probing failed, the receiver might be a value. 439 // If the stub cache probing failed, the receiver might be a value.
443 // For value objects, we use the map of the prototype objects for 440 // For value objects, we use the map of the prototype objects for
444 // the corresponding JSValue for the cache and that is what we need 441 // the corresponding JSValue for the cache and that is what we need
445 // to probe. 442 // to probe.
446 // 443 //
447 // Check for number. 444 // Check for number.
448 __ test(edx, Immediate(kSmiTagMask)); 445 __ test(edx, Immediate(kSmiTagMask));
449 __ j(zero, &number, not_taken); 446 __ j(zero, &number, not_taken);
450 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); 447 __ CmpObjectType(edx, HEAP_NUMBER_TYPE, ebx);
451 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset));
452 __ cmp(ebx, HEAP_NUMBER_TYPE);
453 __ j(not_equal, &non_number, taken); 448 __ j(not_equal, &non_number, taken);
454 __ bind(&number); 449 __ bind(&number);
455 StubCompiler::GenerateLoadGlobalFunctionPrototype( 450 StubCompiler::GenerateLoadGlobalFunctionPrototype(
456 masm, Context::NUMBER_FUNCTION_INDEX, edx); 451 masm, Context::NUMBER_FUNCTION_INDEX, edx);
457 __ jmp(&probe); 452 __ jmp(&probe);
458 453
459 // Check for string. 454 // Check for string.
460 __ bind(&non_number); 455 __ bind(&non_number);
461 __ cmp(ebx, FIRST_NONSTRING_TYPE); 456 __ cmp(ebx, FIRST_NONSTRING_TYPE);
462 __ j(above_equal, &non_string, taken); 457 __ j(above_equal, &non_string, taken);
(...skipping 27 matching lines...) Expand all
490 Label* miss) { 485 Label* miss) {
491 // Search dictionary - put result in register edx. 486 // Search dictionary - put result in register edx.
492 GenerateDictionaryLoad(masm, miss, eax, edx, ebx, ecx); 487 GenerateDictionaryLoad(masm, miss, eax, edx, ebx, ecx);
493 488
494 // Move the result to register edi and check that it isn't a smi. 489 // Move the result to register edi and check that it isn't a smi.
495 __ mov(edi, Operand(edx)); 490 __ mov(edi, Operand(edx));
496 __ test(edx, Immediate(kSmiTagMask)); 491 __ test(edx, Immediate(kSmiTagMask));
497 __ j(zero, miss, not_taken); 492 __ j(zero, miss, not_taken);
498 493
499 // Check that the value is a JavaScript function. 494 // Check that the value is a JavaScript function.
500 __ mov(edx, FieldOperand(edx, HeapObject::kMapOffset)); 495 __ CmpObjectType(edx, JS_FUNCTION_TYPE, edx);
501 __ movzx_b(edx, FieldOperand(edx, Map::kInstanceTypeOffset));
502 __ cmp(edx, JS_FUNCTION_TYPE);
503 __ j(not_equal, miss, not_taken); 496 __ j(not_equal, miss, not_taken);
504 497
505 // Check that the function has been loaded. 498 // Check that the function has been loaded.
506 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 499 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
507 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kLazyLoadDataOffset)); 500 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kLazyLoadDataOffset));
508 __ cmp(edx, Factory::undefined_value()); 501 __ cmp(edx, Factory::undefined_value());
509 __ j(not_equal, miss, not_taken); 502 __ j(not_equal, miss, not_taken);
510 503
511 // Patch the receiver with the global proxy if necessary. 504 // Patch the receiver with the global proxy if necessary.
512 if (is_global_object) { 505 if (is_global_object) {
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 888
896 // Do tail-call to runtime routine. 889 // Do tail-call to runtime routine.
897 __ TailCallRuntime( 890 __ TailCallRuntime(
898 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3); 891 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3);
899 } 892 }
900 893
901 #undef __ 894 #undef __
902 895
903 896
904 } } // namespace v8::internal 897 } } // namespace v8::internal
OLDNEW
« src/builtins-ia32.cc ('K') | « 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