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

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

Issue 545007: Introduce number type information in the virtual frame. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: merged with latest rev. Created 10 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
« no previous file with comments | « src/register-allocator.h ('k') | src/virtual-frame.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 19 matching lines...) Expand all
30 #include "codegen-inl.h" 30 #include "codegen-inl.h"
31 #include "register-allocator-inl.h" 31 #include "register-allocator-inl.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 // ------------------------------------------------------------------------- 36 // -------------------------------------------------------------------------
37 // Result implementation. 37 // Result implementation.
38 38
39 39
40 Result::Result(Register reg) { 40 Result::Result(Register reg, NumberInfo::Type info) {
41 ASSERT(reg.is_valid() && !RegisterAllocator::IsReserved(reg)); 41 ASSERT(reg.is_valid() && !RegisterAllocator::IsReserved(reg));
42 CodeGeneratorScope::Current()->allocator()->Use(reg); 42 CodeGeneratorScope::Current()->allocator()->Use(reg);
43 value_ = TypeField::encode(REGISTER) | DataField::encode(reg.code_); 43 value_ = TypeField::encode(REGISTER)
44 | NumberInfoField::encode(info)
45 | DataField::encode(reg.code_);
44 } 46 }
45 47
46 48
47 Result::ZoneObjectList* Result::ConstantList() { 49 Result::ZoneObjectList* Result::ConstantList() {
48 static ZoneObjectList list(10); 50 static ZoneObjectList list(10);
49 return &list; 51 return &list;
50 } 52 }
51 53
52 54
55 NumberInfo::Type Result::number_info() {
56 ASSERT(is_valid());
57 if (!is_constant()) return NumberInfoField::decode(value_);
58 Handle<Object> value = handle();
59 if (value->IsSmi()) return NumberInfo::kSmi;
60 if (value->IsHeapNumber()) return NumberInfo::kHeapNumber;
61 return NumberInfo::kUnknown;
62 }
63
64
65 void Result::set_number_info(NumberInfo::Type info) {
66 ASSERT(is_valid());
67 value_ = value_ & ~NumberInfoField::mask();
68 value_ = value_ | NumberInfoField::encode(info);
69 }
70
71
53 // ------------------------------------------------------------------------- 72 // -------------------------------------------------------------------------
54 // RegisterAllocator implementation. 73 // RegisterAllocator implementation.
55 74
56 75
57 Result RegisterAllocator::AllocateWithoutSpilling() { 76 Result RegisterAllocator::AllocateWithoutSpilling() {
58 // Return the first free register, if any. 77 // Return the first free register, if any.
59 int num = registers_.ScanForFreeRegister(); 78 int num = registers_.ScanForFreeRegister();
60 if (num == RegisterAllocator::kInvalidRegister) { 79 if (num == RegisterAllocator::kInvalidRegister) {
61 return Result(); 80 return Result();
62 } 81 }
(...skipping 28 matching lines...) Expand all
91 cgen_->frame()->Spill(target); 110 cgen_->frame()->Spill(target);
92 ASSERT(!is_used(target)); 111 ASSERT(!is_used(target));
93 return Result(target); 112 return Result(target);
94 } 113 }
95 // Otherwise (if it's referenced outside the frame) we cannot allocate it. 114 // Otherwise (if it's referenced outside the frame) we cannot allocate it.
96 return Result(); 115 return Result();
97 } 116 }
98 117
99 118
100 } } // namespace v8::internal 119 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/register-allocator.h ('k') | src/virtual-frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698