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

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

Issue 115423: - Fix numeric overflow handling when compiling count operations.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 | « no previous file | no next file » | 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 allocator_ = &register_allocator; 108 allocator_ = &register_allocator;
109 ASSERT(frame_ == NULL); 109 ASSERT(frame_ == NULL);
110 frame_ = new VirtualFrame(this); 110 frame_ = new VirtualFrame(this);
111 set_in_spilled_code(false); 111 set_in_spilled_code(false);
112 112
113 // Adjust for function-level loop nesting. 113 // Adjust for function-level loop nesting.
114 loop_nesting_ += fun->loop_nesting(); 114 loop_nesting_ += fun->loop_nesting();
115 115
116 JumpTarget::set_compiling_deferred_code(false); 116 JumpTarget::set_compiling_deferred_code(false);
117 117
118 #ifdef DEBUG
iposva 2009/05/15 22:35:14 This moved up here to be able to stop before any c
119 if (strlen(FLAG_stop_at) > 0 &&
120 fun->name()->IsEqualTo(CStrVector(FLAG_stop_at))) {
121 frame_->SpillAll();
122 __ int3();
123 }
124 #endif
125
118 { 126 {
119 HistogramTimerScope codegen_timer(&Counters::code_generation); 127 HistogramTimerScope codegen_timer(&Counters::code_generation);
120 CodeGenState state(this); 128 CodeGenState state(this);
121 129
122 // Entry: 130 // Entry:
123 // Stack: receiver, arguments, return address. 131 // Stack: receiver, arguments, return address.
124 // ebp: caller's frame pointer 132 // ebp: caller's frame pointer
125 // esp: stack pointer 133 // esp: stack pointer
126 // edi: called JS function 134 // edi: called JS function
127 // esi: callee's context 135 // esi: callee's context
128 allocator_->Initialize(); 136 allocator_->Initialize();
129 frame_->Enter(); 137 frame_->Enter();
130 138
131 #ifdef DEBUG
132 if (strlen(FLAG_stop_at) > 0 &&
133 fun->name()->IsEqualTo(CStrVector(FLAG_stop_at))) {
134 frame_->SpillAll();
135 __ int3();
136 }
137 #endif
138
139 // Allocate space for locals and initialize them. 139 // Allocate space for locals and initialize them.
140 frame_->AllocateStackSlots(scope_->num_stack_slots()); 140 frame_->AllocateStackSlots(scope_->num_stack_slots());
141 // Initialize the function return target after the locals are set 141 // Initialize the function return target after the locals are set
142 // up, because it needs the expected frame height from the frame. 142 // up, because it needs the expected frame height from the frame.
143 function_return_.Initialize(this, JumpTarget::BIDIRECTIONAL); 143 function_return_.Initialize(this, JumpTarget::BIDIRECTIONAL);
144 function_return_is_shadowed_ = false; 144 function_return_is_shadowed_ = false;
145 145
146 // Allocate the arguments object and copy the parameters into it. 146 // Allocate the arguments object and copy the parameters into it.
147 if (scope_->arguments() != NULL) { 147 if (scope_->arguments() != NULL) {
148 ASSERT(scope_->arguments_shadow() != NULL); 148 ASSERT(scope_->arguments_shadow() != NULL);
(...skipping 4722 matching lines...) Expand 10 before | Expand all | Expand 10 after
4871 } 4871 }
4872 4872
4873 // If the count operation didn't overflow and the result is a 4873 // If the count operation didn't overflow and the result is a
4874 // valid smi, we're done. Otherwise, we jump to the deferred 4874 // valid smi, we're done. Otherwise, we jump to the deferred
4875 // slow-case code. 4875 // slow-case code.
4876 // 4876 //
4877 // We combine the overflow and the smi check if we could 4877 // We combine the overflow and the smi check if we could
4878 // successfully allocate a temporary byte register. 4878 // successfully allocate a temporary byte register.
4879 if (tmp.is_valid()) { 4879 if (tmp.is_valid()) {
4880 __ setcc(overflow, tmp.reg()); 4880 __ setcc(overflow, tmp.reg());
4881 __ or_(Operand(value.reg()), tmp.reg()); 4881 __ or_(Operand(tmp.reg()), value.reg());
4882 __ test(tmp.reg(), Immediate(kSmiTagMask));
4882 tmp.Unuse(); 4883 tmp.Unuse();
4883 __ test(value.reg(), Immediate(kSmiTagMask));
4884 deferred->enter()->Branch(not_zero, &value, not_taken); 4884 deferred->enter()->Branch(not_zero, &value, not_taken);
4885 } else { // Otherwise we test separately for overflow and smi check. 4885 } else { // Otherwise we test separately for overflow and smi check.
4886 deferred->enter()->Branch(overflow, &value, not_taken); 4886 deferred->enter()->Branch(overflow, &value, not_taken);
4887 __ test(value.reg(), Immediate(kSmiTagMask)); 4887 __ test(value.reg(), Immediate(kSmiTagMask));
4888 deferred->enter()->Branch(not_zero, &value, not_taken); 4888 deferred->enter()->Branch(not_zero, &value, not_taken);
4889 } 4889 }
4890 4890
4891 // Store the new value in the target if not const. 4891 // Store the new value in the target if not const.
4892 deferred->BindExit(&value); 4892 deferred->BindExit(&value);
4893 frame_->Push(&value); 4893 frame_->Push(&value);
(...skipping 2362 matching lines...) Expand 10 before | Expand all | Expand 10 after
7256 7256
7257 // Slow-case: Go through the JavaScript implementation. 7257 // Slow-case: Go through the JavaScript implementation.
7258 __ bind(&slow); 7258 __ bind(&slow);
7259 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); 7259 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
7260 } 7260 }
7261 7261
7262 7262
7263 #undef __ 7263 #undef __
7264 7264
7265 } } // namespace v8::internal 7265 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698