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

Side by Side Diff: src/register-allocator-ia32.cc

Issue 21392: Change compiler to safely write unsafe smis when they are spilled from... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: '' Created 11 years, 10 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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 22 matching lines...) Expand all
33 namespace v8 { namespace internal { 33 namespace v8 { namespace internal {
34 34
35 // ------------------------------------------------------------------------- 35 // -------------------------------------------------------------------------
36 // Result implementation. 36 // Result implementation.
37 37
38 void Result::ToRegister() { 38 void Result::ToRegister() {
39 ASSERT(is_valid()); 39 ASSERT(is_valid());
40 if (is_constant()) { 40 if (is_constant()) {
41 Result fresh = cgen_->allocator()->Allocate(); 41 Result fresh = cgen_->allocator()->Allocate();
42 ASSERT(fresh.is_valid()); 42 ASSERT(fresh.is_valid());
43 cgen_->masm()->Set(fresh.reg(), Immediate(handle())); 43 if (cgen_->IsUnsafeSmi(handle())) {
44 cgen_->LoadUnsafeSmi(fresh.reg(), handle());
45 } else {
46 cgen_->masm()->Set(fresh.reg(), Immediate(handle()));
47 }
44 // This result becomes a copy of the fresh one. 48 // This result becomes a copy of the fresh one.
45 *this = fresh; 49 *this = fresh;
46 } 50 }
47 ASSERT(is_register()); 51 ASSERT(is_register());
48 } 52 }
49 53
50 54
51 void Result::ToRegister(Register target) { 55 void Result::ToRegister(Register target) {
52 ASSERT(is_valid()); 56 ASSERT(is_valid());
53 if (!is_register() || !reg().is(target)) { 57 if (!is_register() || !reg().is(target)) {
54 Result fresh = cgen_->allocator()->Allocate(target); 58 Result fresh = cgen_->allocator()->Allocate(target);
55 ASSERT(fresh.is_valid()); 59 ASSERT(fresh.is_valid());
56 if (is_register()) { 60 if (is_register()) {
57 cgen_->masm()->mov(fresh.reg(), reg()); 61 cgen_->masm()->mov(fresh.reg(), reg());
58 } else { 62 } else {
59 ASSERT(is_constant()); 63 ASSERT(is_constant());
60 cgen_->masm()->Set(fresh.reg(), Immediate(handle())); 64 if (cgen_->IsUnsafeSmi(handle())) {
65 cgen_->LoadUnsafeSmi(fresh.reg(), handle());
66 } else {
67 cgen_->masm()->Set(fresh.reg(), Immediate(handle()));
68 }
61 } 69 }
62 *this = fresh; 70 *this = fresh;
63 } else if (is_register() && reg().is(target)) { 71 } else if (is_register() && reg().is(target)) {
64 ASSERT(cgen_->has_valid_frame()); 72 ASSERT(cgen_->has_valid_frame());
65 cgen_->frame()->Spill(target); 73 cgen_->frame()->Spill(target);
66 ASSERT(cgen_->allocator()->count(target) == 1); 74 ASSERT(cgen_->allocator()->count(target) == 1);
67 } 75 }
68 ASSERT(is_register()); 76 ASSERT(is_register());
69 ASSERT(reg().is(target)); 77 ASSERT(reg().is(target));
70 } 78 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // register if valid and return an invalid result. 121 // register if valid and return an invalid result.
114 if (result.is_valid() && !result.reg().is_byte_register()) { 122 if (result.is_valid() && !result.reg().is_byte_register()) {
115 result.Unuse(); 123 result.Unuse();
116 return Result(cgen_); 124 return Result(cgen_);
117 } 125 }
118 return result; 126 return result;
119 } 127 }
120 128
121 129
122 } } // namespace v8::internal 130 } } // namespace v8::internal
OLDNEW
« src/codegen-ia32.cc ('K') | « src/codegen-ia32.cc ('k') | src/virtual-frame-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698