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

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

Issue 1207006: Rename NumberInfo to TypeInfo.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: changed project files Created 10 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/x64/codegen-x64.h ('k') | src/x64/register-allocator-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 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 4350 matching lines...) Expand 10 before | Expand all | Expand 10 after
4361 // 'false_target'/'true_target' as appropriate. 4361 // 'false_target'/'true_target' as appropriate.
4362 void CodeGenerator::ToBoolean(ControlDestination* dest) { 4362 void CodeGenerator::ToBoolean(ControlDestination* dest) {
4363 Comment cmnt(masm_, "[ ToBoolean"); 4363 Comment cmnt(masm_, "[ ToBoolean");
4364 4364
4365 // The value to convert should be popped from the frame. 4365 // The value to convert should be popped from the frame.
4366 Result value = frame_->Pop(); 4366 Result value = frame_->Pop();
4367 value.ToRegister(); 4367 value.ToRegister();
4368 4368
4369 if (value.is_number()) { 4369 if (value.is_number()) {
4370 Comment cmnt(masm_, "ONLY_NUMBER"); 4370 Comment cmnt(masm_, "ONLY_NUMBER");
4371 // Fast case if NumberInfo indicates only numbers. 4371 // Fast case if TypeInfo indicates only numbers.
4372 if (FLAG_debug_code) { 4372 if (FLAG_debug_code) {
4373 __ AbortIfNotNumber(value.reg(), "ToBoolean operand is not a number."); 4373 __ AbortIfNotNumber(value.reg(), "ToBoolean operand is not a number.");
4374 } 4374 }
4375 // Smi => false iff zero. 4375 // Smi => false iff zero.
4376 __ SmiCompare(value.reg(), Smi::FromInt(0)); 4376 __ SmiCompare(value.reg(), Smi::FromInt(0));
4377 dest->false_target()->Branch(equal); 4377 dest->false_target()->Branch(equal);
4378 Condition is_smi = masm_->CheckSmi(value.reg()); 4378 Condition is_smi = masm_->CheckSmi(value.reg());
4379 dest->true_target()->Branch(is_smi); 4379 dest->true_target()->Branch(is_smi);
4380 __ fldz(); 4380 __ fldz();
4381 __ fld_d(FieldOperand(value.reg(), HeapNumber::kValueOffset)); 4381 __ fld_d(FieldOperand(value.reg(), HeapNumber::kValueOffset));
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
5284 right.is_constant() && !right.handle()->IsSmi(); 5284 right.is_constant() && !right.handle()->IsSmi();
5285 5285
5286 if (left_is_smi_constant && right_is_smi_constant) { 5286 if (left_is_smi_constant && right_is_smi_constant) {
5287 // Compute the constant result at compile time, and leave it on the frame. 5287 // Compute the constant result at compile time, and leave it on the frame.
5288 int left_int = Smi::cast(*left.handle())->value(); 5288 int left_int = Smi::cast(*left.handle())->value();
5289 int right_int = Smi::cast(*right.handle())->value(); 5289 int right_int = Smi::cast(*right.handle())->value();
5290 if (FoldConstantSmis(op, left_int, right_int)) return; 5290 if (FoldConstantSmis(op, left_int, right_int)) return;
5291 } 5291 }
5292 5292
5293 // Get number type of left and right sub-expressions. 5293 // Get number type of left and right sub-expressions.
5294 NumberInfo operands_type = 5294 TypeInfo operands_type =
5295 NumberInfo::Combine(left.number_info(), right.number_info()); 5295 TypeInfo::Combine(left.type_info(), right.type_info());
5296 5296
5297 Result answer; 5297 Result answer;
5298 if (left_is_non_smi_constant || right_is_non_smi_constant) { 5298 if (left_is_non_smi_constant || right_is_non_smi_constant) {
5299 GenericBinaryOpStub stub(op, 5299 GenericBinaryOpStub stub(op,
5300 overwrite_mode, 5300 overwrite_mode,
5301 NO_SMI_CODE_IN_STUB, 5301 NO_SMI_CODE_IN_STUB,
5302 operands_type); 5302 operands_type);
5303 answer = stub.GenerateCall(masm_, frame_, &left, &right); 5303 answer = stub.GenerateCall(masm_, frame_, &left, &right);
5304 } else if (right_is_smi_constant) { 5304 } else if (right_is_smi_constant) {
5305 answer = ConstantSmiBinaryOperation(op, &left, right.handle(), 5305 answer = ConstantSmiBinaryOperation(op, &left, right.handle(),
(...skipping 11 matching lines...) Expand all
5317 answer = LikelySmiBinaryOperation(op, &left, &right, overwrite_mode); 5317 answer = LikelySmiBinaryOperation(op, &left, &right, overwrite_mode);
5318 } else { 5318 } else {
5319 GenericBinaryOpStub stub(op, 5319 GenericBinaryOpStub stub(op,
5320 overwrite_mode, 5320 overwrite_mode,
5321 NO_GENERIC_BINARY_FLAGS, 5321 NO_GENERIC_BINARY_FLAGS,
5322 operands_type); 5322 operands_type);
5323 answer = stub.GenerateCall(masm_, frame_, &left, &right); 5323 answer = stub.GenerateCall(masm_, frame_, &left, &right);
5324 } 5324 }
5325 } 5325 }
5326 5326
5327 // Set NumberInfo of result according to the operation performed. 5327 // Set TypeInfo of result according to the operation performed.
5328 // We rely on the fact that smis have a 32 bit payload on x64. 5328 // We rely on the fact that smis have a 32 bit payload on x64.
5329 ASSERT(kSmiValueSize == 32); 5329 ASSERT(kSmiValueSize == 32);
5330 NumberInfo result_type = NumberInfo::Unknown(); 5330 TypeInfo result_type = TypeInfo::Unknown();
5331 switch (op) { 5331 switch (op) {
5332 case Token::COMMA: 5332 case Token::COMMA:
5333 result_type = right.number_info(); 5333 result_type = right.type_info();
5334 break; 5334 break;
5335 case Token::OR: 5335 case Token::OR:
5336 case Token::AND: 5336 case Token::AND:
5337 // Result type can be either of the two input types. 5337 // Result type can be either of the two input types.
5338 result_type = operands_type; 5338 result_type = operands_type;
5339 break; 5339 break;
5340 case Token::BIT_OR: 5340 case Token::BIT_OR:
5341 case Token::BIT_XOR: 5341 case Token::BIT_XOR:
5342 case Token::BIT_AND: 5342 case Token::BIT_AND:
5343 // Result is always a smi. 5343 // Result is always a smi.
5344 result_type = NumberInfo::Smi(); 5344 result_type = TypeInfo::Smi();
5345 break; 5345 break;
5346 case Token::SAR: 5346 case Token::SAR:
5347 case Token::SHL: 5347 case Token::SHL:
5348 // Result is always a smi. 5348 // Result is always a smi.
5349 result_type = NumberInfo::Smi(); 5349 result_type = TypeInfo::Smi();
5350 break; 5350 break;
5351 case Token::SHR: 5351 case Token::SHR:
5352 // Result of x >>> y is always a smi if y >= 1, otherwise a number. 5352 // Result of x >>> y is always a smi if y >= 1, otherwise a number.
5353 result_type = (right.is_constant() && right.handle()->IsSmi() 5353 result_type = (right.is_constant() && right.handle()->IsSmi()
5354 && Smi::cast(*right.handle())->value() >= 1) 5354 && Smi::cast(*right.handle())->value() >= 1)
5355 ? NumberInfo::Smi() 5355 ? TypeInfo::Smi()
5356 : NumberInfo::Number(); 5356 : TypeInfo::Number();
5357 break; 5357 break;
5358 case Token::ADD: 5358 case Token::ADD:
5359 // Result could be a string or a number. Check types of inputs. 5359 // Result could be a string or a number. Check types of inputs.
5360 result_type = operands_type.IsNumber() 5360 result_type = operands_type.IsNumber()
5361 ? NumberInfo::Number() 5361 ? TypeInfo::Number()
5362 : NumberInfo::Unknown(); 5362 : TypeInfo::Unknown();
5363 break; 5363 break;
5364 case Token::SUB: 5364 case Token::SUB:
5365 case Token::MUL: 5365 case Token::MUL:
5366 case Token::DIV: 5366 case Token::DIV:
5367 case Token::MOD: 5367 case Token::MOD:
5368 // Result is always a number. 5368 // Result is always a number.
5369 result_type = NumberInfo::Number(); 5369 result_type = TypeInfo::Number();
5370 break; 5370 break;
5371 default: 5371 default:
5372 UNREACHABLE(); 5372 UNREACHABLE();
5373 } 5373 }
5374 answer.set_number_info(result_type); 5374 answer.set_type_info(result_type);
5375 frame_->Push(&answer); 5375 frame_->Push(&answer);
5376 } 5376 }
5377 5377
5378 5378
5379 // Emit a LoadIC call to get the value from receiver and leave it in 5379 // Emit a LoadIC call to get the value from receiver and leave it in
5380 // dst. The receiver register is restored after the call. 5380 // dst. The receiver register is restored after the call.
5381 class DeferredReferenceGetNamedValue: public DeferredCode { 5381 class DeferredReferenceGetNamedValue: public DeferredCode {
5382 public: 5382 public:
5383 DeferredReferenceGetNamedValue(Register dst, 5383 DeferredReferenceGetNamedValue(Register dst,
5384 Register receiver, 5384 Register receiver,
(...skipping 4602 matching lines...) Expand 10 before | Expand all | Expand 10 after
9987 // Call the function from C++. 9987 // Call the function from C++.
9988 return FUNCTION_CAST<ModuloFunction>(buffer); 9988 return FUNCTION_CAST<ModuloFunction>(buffer);
9989 } 9989 }
9990 9990
9991 #endif 9991 #endif
9992 9992
9993 9993
9994 #undef __ 9994 #undef __
9995 9995
9996 } } // namespace v8::internal 9996 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/codegen-x64.h ('k') | src/x64/register-allocator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698