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

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

Issue 159192: Fix some defects identifies by Coverity Prevent. All are false... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 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/hashmap.cc ('k') | src/zone.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 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 3839 matching lines...) Expand 10 before | Expand all | Expand 10 after
3850 __ mov(tmp.reg(), FieldOperand(tmp.reg(), JSFunction::kContextOffset)); 3850 __ mov(tmp.reg(), FieldOperand(tmp.reg(), JSFunction::kContextOffset));
3851 context = tmp.reg(); 3851 context = tmp.reg();
3852 } 3852 }
3853 // If no outer scope calls eval, we do not need to check more 3853 // If no outer scope calls eval, we do not need to check more
3854 // context extensions. If we have reached an eval scope, we check 3854 // context extensions. If we have reached an eval scope, we check
3855 // all extensions from this point. 3855 // all extensions from this point.
3856 if (!s->outer_scope_calls_eval() || s->is_eval_scope()) break; 3856 if (!s->outer_scope_calls_eval() || s->is_eval_scope()) break;
3857 s = s->outer_scope(); 3857 s = s->outer_scope();
3858 } 3858 }
3859 3859
3860 if (s->is_eval_scope()) { 3860 if (s != NULL && s->is_eval_scope()) {
3861 // Loop up the context chain. There is no frame effect so it is 3861 // Loop up the context chain. There is no frame effect so it is
3862 // safe to use raw labels here. 3862 // safe to use raw labels here.
3863 Label next, fast; 3863 Label next, fast;
3864 if (!context.is(tmp.reg())) { 3864 if (!context.is(tmp.reg())) {
3865 __ mov(tmp.reg(), context); 3865 __ mov(tmp.reg(), context);
3866 } 3866 }
3867 __ bind(&next); 3867 __ bind(&next);
3868 // Terminate at global context. 3868 // Terminate at global context.
3869 __ cmp(FieldOperand(tmp.reg(), HeapObject::kMapOffset), 3869 __ cmp(FieldOperand(tmp.reg(), HeapObject::kMapOffset),
3870 Immediate(Factory::global_context_map())); 3870 Immediate(Factory::global_context_map()));
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after
5381 // It will be discarded anyway, and can have no side effect. 5381 // It will be discarded anyway, and can have no side effect.
5382 frame_->Push(Factory::undefined_value()); 5382 frame_->Push(Factory::undefined_value());
5383 } else { 5383 } else {
5384 Load(node->expression()); 5384 Load(node->expression());
5385 frame_->SetElementAt(0, Factory::undefined_value()); 5385 frame_->SetElementAt(0, Factory::undefined_value());
5386 } 5386 }
5387 5387
5388 } else { 5388 } else {
5389 Load(node->expression()); 5389 Load(node->expression());
5390 switch (op) { 5390 switch (op) {
5391 case Token::NOT:
5392 case Token::DELETE:
5393 case Token::TYPEOF:
5394 UNREACHABLE(); // handled above
5395 break;
5396
5397 case Token::SUB: { 5391 case Token::SUB: {
5398 bool overwrite = 5392 bool overwrite =
5399 (node->AsBinaryOperation() != NULL && 5393 (node->AsBinaryOperation() != NULL &&
5400 node->AsBinaryOperation()->ResultOverwriteAllowed()); 5394 node->AsBinaryOperation()->ResultOverwriteAllowed());
5401 UnarySubStub stub(overwrite); 5395 UnarySubStub stub(overwrite);
5402 // TODO(1222589): remove dependency of TOS being cached inside stub 5396 // TODO(1222589): remove dependency of TOS being cached inside stub
5403 Result operand = frame_->Pop(); 5397 Result operand = frame_->Pop();
5404 Result answer = frame_->CallStub(&stub, &operand); 5398 Result answer = frame_->CallStub(&stub, &operand);
5405 frame_->Push(&answer); 5399 frame_->Push(&answer);
5406 break; 5400 break;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
5441 frame_->Push(&operand); 5435 frame_->Push(&operand);
5442 Result answer = frame_->InvokeBuiltin(Builtins::TO_NUMBER, 5436 Result answer = frame_->InvokeBuiltin(Builtins::TO_NUMBER,
5443 CALL_FUNCTION, 1); 5437 CALL_FUNCTION, 1);
5444 5438
5445 continue_label.Bind(&answer); 5439 continue_label.Bind(&answer);
5446 frame_->Push(&answer); 5440 frame_->Push(&answer);
5447 break; 5441 break;
5448 } 5442 }
5449 5443
5450 default: 5444 default:
5445 // NOT, DELETE, TYPEOF, and VOID are handled outside the
5446 // switch.
5451 UNREACHABLE(); 5447 UNREACHABLE();
5452 } 5448 }
5453 } 5449 }
5454 } 5450 }
5455 5451
5456 5452
5457 // The value in dst was optimistically incremented or decremented. The 5453 // The value in dst was optimistically incremented or decremented. The
5458 // result overflowed or was not smi tagged. Undo the operation, call 5454 // result overflowed or was not smi tagged. Undo the operation, call
5459 // into the runtime to convert the argument to a number, and call the 5455 // into the runtime to convert the argument to a number, and call the
5460 // specialized add or subtract stub. The result is left in dst. 5456 // specialized add or subtract stub. The result is left in dst.
(...skipping 2460 matching lines...) Expand 10 before | Expand all | Expand 10 after
7921 7917
7922 int CompareStub::MinorKey() { 7918 int CompareStub::MinorKey() {
7923 // Encode the two parameters in a unique 16 bit value. 7919 // Encode the two parameters in a unique 16 bit value.
7924 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 7920 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
7925 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 7921 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
7926 } 7922 }
7927 7923
7928 #undef __ 7924 #undef __
7929 7925
7930 } } // namespace v8::internal 7926 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hashmap.cc ('k') | src/zone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698