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

Side by Side Diff: src/type-info.cc

Issue 6879081: Added type recording for unary minus and unary bitwise negation. Note that the (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Incorporated Florian's suggested changes 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
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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 case CompareIC::OBJECTS: 232 case CompareIC::OBJECTS:
233 // TODO(kasperl): We really need a type for JS objects here. 233 // TODO(kasperl): We really need a type for JS objects here.
234 return TypeInfo::NonPrimitive(); 234 return TypeInfo::NonPrimitive();
235 case CompareIC::GENERIC: 235 case CompareIC::GENERIC:
236 default: 236 default:
237 return unknown; 237 return unknown;
238 } 238 }
239 } 239 }
240 240
241 241
242 TypeInfo TypeFeedbackOracle::UnaryType(UnaryOperation* expr) {
243 Handle<Object> object = GetInfo(expr->position());
244 TypeInfo unknown = TypeInfo::Unknown();
245 if (!object->IsCode()) return unknown;
246 Handle<Code> code = Handle<Code>::cast(object);
247 ASSERT(code->is_type_recording_unary_op_stub());
248 TRUnaryOpIC::TypeInfo type = static_cast<TRUnaryOpIC::TypeInfo>(
249 code->type_recording_unary_op_type());
250 switch (type) {
251 case TRUnaryOpIC::SMI:
252 return TypeInfo::Smi();
253 case TRUnaryOpIC::HEAP_NUMBER:
254 return TypeInfo::Double();
255 default:
256 return unknown;
257 }
258 }
259
260
242 TypeInfo TypeFeedbackOracle::BinaryType(BinaryOperation* expr) { 261 TypeInfo TypeFeedbackOracle::BinaryType(BinaryOperation* expr) {
243 Handle<Object> object = GetInfo(expr->position()); 262 Handle<Object> object = GetInfo(expr->position());
244 TypeInfo unknown = TypeInfo::Unknown(); 263 TypeInfo unknown = TypeInfo::Unknown();
245 if (!object->IsCode()) return unknown; 264 if (!object->IsCode()) return unknown;
246 Handle<Code> code = Handle<Code>::cast(object); 265 Handle<Code> code = Handle<Code>::cast(object);
247 if (code->is_type_recording_binary_op_stub()) { 266 if (code->is_type_recording_binary_op_stub()) {
248 TRBinaryOpIC::TypeInfo type = static_cast<TRBinaryOpIC::TypeInfo>( 267 TRBinaryOpIC::TypeInfo type = static_cast<TRBinaryOpIC::TypeInfo>(
249 code->type_recording_binary_op_type()); 268 code->type_recording_binary_op_type());
250 TRBinaryOpIC::TypeInfo result_type = static_cast<TRBinaryOpIC::TypeInfo>( 269 TRBinaryOpIC::TypeInfo result_type = static_cast<TRBinaryOpIC::TypeInfo>(
251 code->type_recording_binary_op_result_type()); 270 code->type_recording_binary_op_result_type());
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 source_positions->Add(position); 466 source_positions->Add(position);
448 } 467 }
449 } else { 468 } else {
450 ASSERT(RelocInfo::IsPosition(mode)); 469 ASSERT(RelocInfo::IsPosition(mode));
451 position = static_cast<int>(info->data()); 470 position = static_cast<int>(info->data());
452 } 471 }
453 } 472 }
454 } 473 }
455 474
456 } } // namespace v8::internal 475 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698