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

Side by Side Diff: src/typing.cc

Issue 22715004: Version 3.20.15 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Add TypedArray API and correctness patches r16033 and r16084 Created 7 years, 4 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/type-info.cc ('k') | src/v8.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 397 }
398 398
399 // We don't know anything about the type. 399 // We don't know anything about the type.
400 } 400 }
401 401
402 402
403 void AstTyper::VisitUnaryOperation(UnaryOperation* expr) { 403 void AstTyper::VisitUnaryOperation(UnaryOperation* expr) {
404 RECURSE(Visit(expr->expression())); 404 RECURSE(Visit(expr->expression()));
405 405
406 // Collect type feedback. 406 // Collect type feedback.
407 Handle<Type> op_type = oracle()->UnaryType(expr->UnaryOperationFeedbackId());
408 NarrowLowerType(expr->expression(), op_type);
407 if (expr->op() == Token::NOT) { 409 if (expr->op() == Token::NOT) {
408 // TODO(rossberg): only do in test or value context. 410 // TODO(rossberg): only do in test or value context.
409 expr->expression()->RecordToBooleanTypeFeedback(oracle()); 411 expr->expression()->RecordToBooleanTypeFeedback(oracle());
410 } 412 }
411 413
412 switch (expr->op()) { 414 switch (expr->op()) {
413 case Token::NOT: 415 case Token::NOT:
414 case Token::DELETE: 416 case Token::DELETE:
415 NarrowType(expr, Bounds(Type::Boolean(), isolate_)); 417 NarrowType(expr, Bounds(Type::Boolean(), isolate_));
416 break; 418 break;
417 case Token::VOID: 419 case Token::VOID:
418 NarrowType(expr, Bounds(Type::Undefined(), isolate_)); 420 NarrowType(expr, Bounds(Type::Undefined(), isolate_));
419 break; 421 break;
422 case Token::ADD:
423 case Token::SUB: {
424 Type* upper = *expr->expression()->bounds().upper;
425 if (!upper->Is(Type::Number())) upper = Type::Number();
426 NarrowType(expr, Bounds(Type::Smi(), upper, isolate_));
427 break;
428 }
429 case Token::BIT_NOT:
430 NarrowType(expr, Bounds(Type::Smi(), Type::Signed32(), isolate_));
431 break;
420 case Token::TYPEOF: 432 case Token::TYPEOF:
421 NarrowType(expr, Bounds(Type::InternalizedString(), isolate_)); 433 NarrowType(expr, Bounds(Type::InternalizedString(), isolate_));
422 break; 434 break;
423 default: 435 default:
424 UNREACHABLE(); 436 UNREACHABLE();
425 } 437 }
426 } 438 }
427 439
428 440
429 void AstTyper::VisitCountOperation(CountOperation* expr) { 441 void AstTyper::VisitCountOperation(CountOperation* expr) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 void AstTyper::VisitModuleUrl(ModuleUrl* module) { 589 void AstTyper::VisitModuleUrl(ModuleUrl* module) {
578 } 590 }
579 591
580 592
581 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { 593 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) {
582 RECURSE(Visit(stmt->body())); 594 RECURSE(Visit(stmt->body()));
583 } 595 }
584 596
585 597
586 } } // namespace v8::internal 598 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-info.cc ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698