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

Side by Side Diff: src/ic.cc

Issue 6744006: Add binary-op stub variant to handle oddball objects more efficiently. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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/ic.h ('k') | src/x64/code-stubs-x64.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-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 set_target(code); 2124 set_target(code);
2125 } 2125 }
2126 2126
2127 2127
2128 const char* TRBinaryOpIC::GetName(TypeInfo type_info) { 2128 const char* TRBinaryOpIC::GetName(TypeInfo type_info) {
2129 switch (type_info) { 2129 switch (type_info) {
2130 case UNINITIALIZED: return "Uninitialized"; 2130 case UNINITIALIZED: return "Uninitialized";
2131 case SMI: return "SMI"; 2131 case SMI: return "SMI";
2132 case INT32: return "Int32s"; 2132 case INT32: return "Int32s";
2133 case HEAP_NUMBER: return "HeapNumbers"; 2133 case HEAP_NUMBER: return "HeapNumbers";
2134 case ODDBALL: return "Oddball";
2134 case STRING: return "Strings"; 2135 case STRING: return "Strings";
2135 case GENERIC: return "Generic"; 2136 case GENERIC: return "Generic";
2136 default: return "Invalid"; 2137 default: return "Invalid";
2137 } 2138 }
2138 } 2139 }
2139 2140
2140 2141
2141 TRBinaryOpIC::State TRBinaryOpIC::ToState(TypeInfo type_info) { 2142 TRBinaryOpIC::State TRBinaryOpIC::ToState(TypeInfo type_info) {
2142 switch (type_info) { 2143 switch (type_info) {
2143 case UNINITIALIZED: 2144 case UNINITIALIZED:
2144 return ::v8::internal::UNINITIALIZED; 2145 return ::v8::internal::UNINITIALIZED;
2145 case SMI: 2146 case SMI:
2146 case INT32: 2147 case INT32:
2147 case HEAP_NUMBER: 2148 case HEAP_NUMBER:
2149 case ODDBALL:
2148 case STRING: 2150 case STRING:
2149 return MONOMORPHIC; 2151 return MONOMORPHIC;
2150 case GENERIC: 2152 case GENERIC:
2151 return MEGAMORPHIC; 2153 return MEGAMORPHIC;
2152 } 2154 }
2153 UNREACHABLE(); 2155 UNREACHABLE();
2154 return ::v8::internal::UNINITIALIZED; 2156 return ::v8::internal::UNINITIALIZED;
2155 } 2157 }
2156 2158
2157 2159
(...skipping 27 matching lines...) Expand all
2185 if (left_type.IsNumber() && right_type.IsNumber()) { 2187 if (left_type.IsNumber() && right_type.IsNumber()) {
2186 return HEAP_NUMBER; 2188 return HEAP_NUMBER;
2187 } 2189 }
2188 2190
2189 if (left_type.IsString() || right_type.IsString()) { 2191 if (left_type.IsString() || right_type.IsString()) {
2190 // Patching for fast string ADD makes sense even if only one of the 2192 // Patching for fast string ADD makes sense even if only one of the
2191 // arguments is a string. 2193 // arguments is a string.
2192 return STRING; 2194 return STRING;
2193 } 2195 }
2194 2196
2197 // Check for oddball objects.
2198 if (left->IsUndefined() && right->IsNumber()) return ODDBALL;
2199 if (left->IsNumber() && right->IsUndefined()) return ODDBALL;
2200
2195 return GENERIC; 2201 return GENERIC;
2196 } 2202 }
2197 2203
2198 2204
2199 // defined in code-stubs-<arch>.cc 2205 // defined in code-stubs-<arch>.cc
2200 // Only needed to remove dependency of ic.cc on code-stubs-<arch>.h. 2206 // Only needed to remove dependency of ic.cc on code-stubs-<arch>.h.
2201 Handle<Code> GetTypeRecordingBinaryOpStub(int key, 2207 Handle<Code> GetTypeRecordingBinaryOpStub(int key,
2202 TRBinaryOpIC::TypeInfo type_info, 2208 TRBinaryOpIC::TypeInfo type_info,
2203 TRBinaryOpIC::TypeInfo result_type); 2209 TRBinaryOpIC::TypeInfo result_type);
2204 2210
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2376 #undef ADDR 2382 #undef ADDR
2377 }; 2383 };
2378 2384
2379 2385
2380 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2386 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2381 return IC_utilities[id]; 2387 return IC_utilities[id];
2382 } 2388 }
2383 2389
2384 2390
2385 } } // namespace v8::internal 2391 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/x64/code-stubs-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698