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

Side by Side Diff: src/objects.cc

Issue 15735005: Collect type feedback for power-of-2 right operands in BinaryOps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ARM INT32 stub Created 7 years, 6 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 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 Name* name, 148 Name* name,
149 PropertyAttributes* attributes) { 149 PropertyAttributes* attributes) {
150 LookupResult result(name->GetIsolate()); 150 LookupResult result(name->GetIsolate());
151 Lookup(name, &result); 151 Lookup(name, &result);
152 MaybeObject* value = GetProperty(receiver, &result, name, attributes); 152 MaybeObject* value = GetProperty(receiver, &result, name, attributes);
153 ASSERT(*attributes <= ABSENT); 153 ASSERT(*attributes <= ABSENT);
154 return value; 154 return value;
155 } 155 }
156 156
157 157
158 bool Object::ToInt32(int32_t* value) {
159 if (IsSmi()) {
160 *value = Smi::cast(this)->value();
161 return true;
162 }
163 if (IsHeapNumber()) {
164 double num = HeapNumber::cast(this)->value();
165 if (FastI2D(FastD2I(num)) == num) {
166 *value = FastD2I(num);
167 return true;
168 }
169 }
170 return false;
171 }
172
173
174 bool Object::ToUint32(uint32_t* value) {
175 if (IsSmi()) {
176 int num = Smi::cast(this)->value();
177 if (num >= 0) {
178 *value = static_cast<uint32_t>(num);
179 return true;
180 }
181 }
182 if (IsHeapNumber()) {
183 double num = HeapNumber::cast(this)->value();
184 if (num >= 0 && FastUI2D(FastD2UI(num)) == num) {
185 *value = FastD2UI(num);
186 return true;
187 }
188 }
189 return false;
190 }
191
192
158 template<typename To> 193 template<typename To>
159 static inline To* CheckedCast(void *from) { 194 static inline To* CheckedCast(void *from) {
160 uintptr_t temp = reinterpret_cast<uintptr_t>(from); 195 uintptr_t temp = reinterpret_cast<uintptr_t>(from);
161 ASSERT(temp % sizeof(To) == 0); 196 ASSERT(temp % sizeof(To) == 0);
162 return reinterpret_cast<To*>(temp); 197 return reinterpret_cast<To*>(temp);
163 } 198 }
164 199
165 200
166 static MaybeObject* PerformCompare(const BitmaskCompareDescriptor& descriptor, 201 static MaybeObject* PerformCompare(const BitmaskCompareDescriptor& descriptor,
167 char* ptr, 202 char* ptr,
(...skipping 15474 matching lines...) Expand 10 before | Expand all | Expand 10 after
15642 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 15677 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
15643 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 15678 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
15644 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 15679 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
15645 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 15680 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
15646 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 15681 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
15647 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 15682 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
15648 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 15683 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
15649 } 15684 }
15650 15685
15651 } } // namespace v8::internal 15686 } } // namespace v8::internal
OLDNEW
« src/code-stubs.h ('K') | « src/objects.h ('k') | src/type-info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698