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

Side by Side Diff: src/ic.cc

Issue 7037025: Fix handling of -0 in the unary-op IC and avoid repeated patching/transitions. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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 | « src/ic.h ('k') | src/x64/code-stubs-x64.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2193 if (operand_type.IsSmi()) { 2193 if (operand_type.IsSmi()) {
2194 return SMI; 2194 return SMI;
2195 } else if (operand_type.IsNumber()) { 2195 } else if (operand_type.IsNumber()) {
2196 return HEAP_NUMBER; 2196 return HEAP_NUMBER;
2197 } else { 2197 } else {
2198 return GENERIC; 2198 return GENERIC;
2199 } 2199 }
2200 } 2200 }
2201 2201
2202 2202
2203 TRUnaryOpIC::TypeInfo TRUnaryOpIC::JoinTypes(TRUnaryOpIC::TypeInfo x, 2203 TRUnaryOpIC::TypeInfo TRUnaryOpIC::ComputeNewType(
2204 TRUnaryOpIC::TypeInfo y) { 2204 TRUnaryOpIC::TypeInfo type,
2205 return x >= y ? x : y; 2205 TRUnaryOpIC::TypeInfo previous) {
2206 switch (previous) {
2207 case TRUnaryOpIC::UNINITIALIZED:
2208 return type;
2209 case TRUnaryOpIC::SMI:
2210 return (type == TRUnaryOpIC::GENERIC)
2211 ? TRUnaryOpIC::GENERIC
2212 : TRUnaryOpIC::HEAP_NUMBER;
2213 case TRUnaryOpIC::HEAP_NUMBER:
2214 return TRUnaryOpIC::GENERIC;
2215 case TRUnaryOpIC::GENERIC:
2216 // We should never do patching if we are in GENERIC state.
2217 UNREACHABLE();
2218 return TRUnaryOpIC::GENERIC;
2219 }
2206 } 2220 }
2207 2221
2208 2222
2209 void TRBinaryOpIC::patch(Code* code) { 2223 void TRBinaryOpIC::patch(Code* code) {
2210 set_target(code); 2224 set_target(code);
2211 } 2225 }
2212 2226
2213 2227
2214 const char* TRBinaryOpIC::GetName(TypeInfo type_info) { 2228 const char* TRBinaryOpIC::GetName(TypeInfo type_info) {
2215 switch (type_info) { 2229 switch (type_info) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2307 ASSERT(args.length() == 4); 2321 ASSERT(args.length() == 4);
2308 2322
2309 HandleScope scope(isolate); 2323 HandleScope scope(isolate);
2310 Handle<Object> operand = args.at<Object>(0); 2324 Handle<Object> operand = args.at<Object>(0);
2311 int key = Smi::cast(args[1])->value(); 2325 int key = Smi::cast(args[1])->value();
2312 Token::Value op = static_cast<Token::Value>(Smi::cast(args[2])->value()); 2326 Token::Value op = static_cast<Token::Value>(Smi::cast(args[2])->value());
2313 TRUnaryOpIC::TypeInfo previous_type = 2327 TRUnaryOpIC::TypeInfo previous_type =
2314 static_cast<TRUnaryOpIC::TypeInfo>(Smi::cast(args[3])->value()); 2328 static_cast<TRUnaryOpIC::TypeInfo>(Smi::cast(args[3])->value());
2315 2329
2316 TRUnaryOpIC::TypeInfo type = TRUnaryOpIC::GetTypeInfo(operand); 2330 TRUnaryOpIC::TypeInfo type = TRUnaryOpIC::GetTypeInfo(operand);
2317 type = TRUnaryOpIC::JoinTypes(type, previous_type); 2331 type = TRUnaryOpIC::ComputeNewType(type, previous_type);
2318 2332
2319 Handle<Code> code = GetTypeRecordingUnaryOpStub(key, type); 2333 Handle<Code> code = GetTypeRecordingUnaryOpStub(key, type);
2320 if (!code.is_null()) { 2334 if (!code.is_null()) {
2321 if (FLAG_trace_ic) { 2335 if (FLAG_trace_ic) {
2322 PrintF("[TypeRecordingUnaryOpIC (%s->%s)#%s]\n", 2336 PrintF("[TypeRecordingUnaryOpIC (%s->%s)#%s]\n",
2323 TRUnaryOpIC::GetName(previous_type), 2337 TRUnaryOpIC::GetName(previous_type),
2324 TRUnaryOpIC::GetName(type), 2338 TRUnaryOpIC::GetName(type),
2325 Token::Name(op)); 2339 Token::Name(op));
2326 } 2340 }
2327 TRUnaryOpIC ic(isolate); 2341 TRUnaryOpIC ic(isolate);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2538 #undef ADDR 2552 #undef ADDR
2539 }; 2553 };
2540 2554
2541 2555
2542 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2556 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2543 return IC_utilities[id]; 2557 return IC_utilities[id];
2544 } 2558 }
2545 2559
2546 2560
2547 } } // namespace v8::internal 2561 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698