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

Side by Side Diff: src/arm/codegen-arm.cc

Issue 1765012: Add a single-element global positive and negative cache to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 7 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 | « no previous file | src/arm/macro-assembler-arm.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 7908 matching lines...) Expand 10 before | Expand all | Expand 10 after
7919 __ BranchOnSmi(r0, &slow); 7919 __ BranchOnSmi(r0, &slow);
7920 7920
7921 // Check that the left hand is a JS object and put map in r3. 7921 // Check that the left hand is a JS object and put map in r3.
7922 __ CompareObjectType(r0, r3, r2, FIRST_JS_OBJECT_TYPE); 7922 __ CompareObjectType(r0, r3, r2, FIRST_JS_OBJECT_TYPE);
7923 __ b(lt, &slow); 7923 __ b(lt, &slow);
7924 __ cmp(r2, Operand(LAST_JS_OBJECT_TYPE)); 7924 __ cmp(r2, Operand(LAST_JS_OBJECT_TYPE));
7925 __ b(gt, &slow); 7925 __ b(gt, &slow);
7926 7926
7927 // Get the prototype of the function (r4 is result, r2 is scratch). 7927 // Get the prototype of the function (r4 is result, r2 is scratch).
7928 __ ldr(r1, MemOperand(sp, 0)); 7928 __ ldr(r1, MemOperand(sp, 0));
7929 // r1 is function, r3 is map.
7930
7931 // Look up the function and the map in the instanceof cache.
7932 Label miss;
7933 __ LoadRoot(ip, Heap::kInstanceofCacheFunctionRootIndex);
7934 __ cmp(r1, ip);
7935 __ b(ne, &miss);
7936 __ LoadRoot(ip, Heap::kInstanceofCacheMapRootIndex);
7937 __ cmp(r3, ip);
7938 __ b(ne, &miss);
7939 __ LoadRoot(r0, Heap::kInstanceofCacheAnswerRootIndex);
7940 __ pop();
7941 __ pop();
7942 __ mov(pc, Operand(lr));
7943
7944 __ bind(&miss);
7929 __ TryGetFunctionPrototype(r1, r4, r2, &slow); 7945 __ TryGetFunctionPrototype(r1, r4, r2, &slow);
7930 7946
7931 // Check that the function prototype is a JS object. 7947 // Check that the function prototype is a JS object.
7932 __ BranchOnSmi(r4, &slow); 7948 __ BranchOnSmi(r4, &slow);
7933 __ CompareObjectType(r4, r5, r5, FIRST_JS_OBJECT_TYPE); 7949 __ CompareObjectType(r4, r5, r5, FIRST_JS_OBJECT_TYPE);
7934 __ b(lt, &slow); 7950 __ b(lt, &slow);
7935 __ cmp(r5, Operand(LAST_JS_OBJECT_TYPE)); 7951 __ cmp(r5, Operand(LAST_JS_OBJECT_TYPE));
7936 __ b(gt, &slow); 7952 __ b(gt, &slow);
7937 7953
7954 __ StoreRoot(r1, Heap::kInstanceofCacheFunctionRootIndex);
7955 __ StoreRoot(r3, Heap::kInstanceofCacheMapRootIndex);
7956
7938 // Register mapping: r3 is object map and r4 is function prototype. 7957 // Register mapping: r3 is object map and r4 is function prototype.
7939 // Get prototype of object into r2. 7958 // Get prototype of object into r2.
7940 __ ldr(r2, FieldMemOperand(r3, Map::kPrototypeOffset)); 7959 __ ldr(r2, FieldMemOperand(r3, Map::kPrototypeOffset));
7941 7960
7942 // Loop through the prototype chain looking for the function prototype. 7961 // Loop through the prototype chain looking for the function prototype.
7943 __ bind(&loop); 7962 __ bind(&loop);
7944 __ cmp(r2, Operand(r4)); 7963 __ cmp(r2, Operand(r4));
7945 __ b(eq, &is_instance); 7964 __ b(eq, &is_instance);
7946 __ LoadRoot(ip, Heap::kNullValueRootIndex); 7965 __ LoadRoot(ip, Heap::kNullValueRootIndex);
7947 __ cmp(r2, ip); 7966 __ cmp(r2, ip);
7948 __ b(eq, &is_not_instance); 7967 __ b(eq, &is_not_instance);
7949 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); 7968 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset));
7950 __ ldr(r2, FieldMemOperand(r2, Map::kPrototypeOffset)); 7969 __ ldr(r2, FieldMemOperand(r2, Map::kPrototypeOffset));
7951 __ jmp(&loop); 7970 __ jmp(&loop);
7952 7971
7953 __ bind(&is_instance); 7972 __ bind(&is_instance);
7954 __ mov(r0, Operand(Smi::FromInt(0))); 7973 __ mov(r0, Operand(Smi::FromInt(0)));
7974 __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex);
7955 __ pop(); 7975 __ pop();
7956 __ pop(); 7976 __ pop();
7957 __ mov(pc, Operand(lr)); // Return. 7977 __ mov(pc, Operand(lr)); // Return.
7958 7978
7959 __ bind(&is_not_instance); 7979 __ bind(&is_not_instance);
7960 __ mov(r0, Operand(Smi::FromInt(1))); 7980 __ mov(r0, Operand(Smi::FromInt(1)));
7981 __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex);
7961 __ pop(); 7982 __ pop();
7962 __ pop(); 7983 __ pop();
7963 __ mov(pc, Operand(lr)); // Return. 7984 __ mov(pc, Operand(lr)); // Return.
7964 7985
7965 // Slow-case. Tail call builtin. 7986 // Slow-case. Tail call builtin.
7966 __ bind(&slow); 7987 __ bind(&slow);
7967 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS); 7988 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS);
7968 } 7989 }
7969 7990
7970 7991
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after
9449 9470
9450 // Just jump to runtime to add the two strings. 9471 // Just jump to runtime to add the two strings.
9451 __ bind(&string_add_runtime); 9472 __ bind(&string_add_runtime);
9452 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); 9473 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
9453 } 9474 }
9454 9475
9455 9476
9456 #undef __ 9477 #undef __
9457 9478
9458 } } // namespace v8::internal 9479 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698