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

Side by Side Diff: src/type-info.cc

Issue 1655833002: Remove the template magic from types.(h|cc), remove types-inl.h. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Undo whitespace change Created 4 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
« no previous file with comments | « src/type-cache.cc ('k') | src/types.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/type-info.h" 5 #include "src/type-info.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/ic/ic.h" 10 #include "src/ic/ic.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 193 }
194 194
195 195
196 void TypeFeedbackOracle::CompareType(TypeFeedbackId id, 196 void TypeFeedbackOracle::CompareType(TypeFeedbackId id,
197 Type** left_type, 197 Type** left_type,
198 Type** right_type, 198 Type** right_type,
199 Type** combined_type) { 199 Type** combined_type) {
200 Handle<Object> info = GetInfo(id); 200 Handle<Object> info = GetInfo(id);
201 if (!info->IsCode()) { 201 if (!info->IsCode()) {
202 // For some comparisons we don't have ICs, e.g. LiteralCompareTypeof. 202 // For some comparisons we don't have ICs, e.g. LiteralCompareTypeof.
203 *left_type = *right_type = *combined_type = Type::None(zone()); 203 *left_type = *right_type = *combined_type = Type::None();
204 return; 204 return;
205 } 205 }
206 Handle<Code> code = Handle<Code>::cast(info); 206 Handle<Code> code = Handle<Code>::cast(info);
207 207
208 Handle<Map> map; 208 Handle<Map> map;
209 Map* raw_map = code->FindFirstMap(); 209 Map* raw_map = code->FindFirstMap();
210 if (raw_map != NULL) Map::TryUpdate(handle(raw_map)).ToHandle(&map); 210 if (raw_map != NULL) Map::TryUpdate(handle(raw_map)).ToHandle(&map);
211 211
212 if (code->is_compare_ic_stub()) { 212 if (code->is_compare_ic_stub()) {
213 CompareICStub stub(code->stub_key(), isolate()); 213 CompareICStub stub(code->stub_key(), isolate());
(...skipping 14 matching lines...) Expand all
228 Type** result, 228 Type** result,
229 Maybe<int>* fixed_right_arg, 229 Maybe<int>* fixed_right_arg,
230 Handle<AllocationSite>* allocation_site, 230 Handle<AllocationSite>* allocation_site,
231 Token::Value op) { 231 Token::Value op) {
232 Handle<Object> object = GetInfo(id); 232 Handle<Object> object = GetInfo(id);
233 if (!object->IsCode()) { 233 if (!object->IsCode()) {
234 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the 234 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the
235 // operations covered by the BinaryOpIC we should always have them. 235 // operations covered by the BinaryOpIC we should always have them.
236 DCHECK(op < BinaryOpICState::FIRST_TOKEN || 236 DCHECK(op < BinaryOpICState::FIRST_TOKEN ||
237 op > BinaryOpICState::LAST_TOKEN); 237 op > BinaryOpICState::LAST_TOKEN);
238 *left = *right = *result = Type::None(zone()); 238 *left = *right = *result = Type::None();
239 *fixed_right_arg = Nothing<int>(); 239 *fixed_right_arg = Nothing<int>();
240 *allocation_site = Handle<AllocationSite>::null(); 240 *allocation_site = Handle<AllocationSite>::null();
241 return; 241 return;
242 } 242 }
243 Handle<Code> code = Handle<Code>::cast(object); 243 Handle<Code> code = Handle<Code>::cast(object);
244 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); 244 DCHECK_EQ(Code::BINARY_OP_IC, code->kind());
245 BinaryOpICState state(isolate(), code->extra_ic_state()); 245 BinaryOpICState state(isolate(), code->extra_ic_state());
246 DCHECK_EQ(op, state.op()); 246 DCHECK_EQ(op, state.op());
247 247
248 *left = state.GetLeftType(); 248 *left = state.GetLeftType();
249 *right = state.GetRightType(); 249 *right = state.GetRightType();
250 *result = state.GetResultType(); 250 *result = state.GetResultType();
251 *fixed_right_arg = state.fixed_right_arg(); 251 *fixed_right_arg = state.fixed_right_arg();
252 252
253 AllocationSite* first_allocation_site = code->FindFirstAllocationSite(); 253 AllocationSite* first_allocation_site = code->FindFirstAllocationSite();
254 if (first_allocation_site != NULL) { 254 if (first_allocation_site != NULL) {
255 *allocation_site = handle(first_allocation_site); 255 *allocation_site = handle(first_allocation_site);
256 } else { 256 } else {
257 *allocation_site = Handle<AllocationSite>::null(); 257 *allocation_site = Handle<AllocationSite>::null();
258 } 258 }
259 } 259 }
260 260
261 261
262 Type* TypeFeedbackOracle::CountType(TypeFeedbackId id) { 262 Type* TypeFeedbackOracle::CountType(TypeFeedbackId id) {
263 Handle<Object> object = GetInfo(id); 263 Handle<Object> object = GetInfo(id);
264 if (!object->IsCode()) return Type::None(zone()); 264 if (!object->IsCode()) return Type::None();
265 Handle<Code> code = Handle<Code>::cast(object); 265 Handle<Code> code = Handle<Code>::cast(object);
266 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); 266 DCHECK_EQ(Code::BINARY_OP_IC, code->kind());
267 BinaryOpICState state(isolate(), code->extra_ic_state()); 267 BinaryOpICState state(isolate(), code->extra_ic_state());
268 return state.GetLeftType(); 268 return state.GetLeftType();
269 } 269 }
270 270
271 271
272 bool TypeFeedbackOracle::HasOnlyStringMaps(SmallMapList* receiver_types) { 272 bool TypeFeedbackOracle::HasOnlyStringMaps(SmallMapList* receiver_types) {
273 bool all_strings = receiver_types->length() > 0; 273 bool all_strings = receiver_types->length() > 0;
274 for (int i = 0; i < receiver_types->length(); i++) { 274 for (int i = 0; i < receiver_types->length(); i++) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 // Dictionary has been allocated with sufficient size for all elements. 474 // Dictionary has been allocated with sufficient size for all elements.
475 DisallowHeapAllocation no_need_to_resize_dictionary; 475 DisallowHeapAllocation no_need_to_resize_dictionary;
476 HandleScope scope(isolate()); 476 HandleScope scope(isolate());
477 USE(UnseededNumberDictionary::AtNumberPut( 477 USE(UnseededNumberDictionary::AtNumberPut(
478 dictionary_, IdToKey(ast_id), handle(target, isolate()))); 478 dictionary_, IdToKey(ast_id), handle(target, isolate())));
479 } 479 }
480 480
481 481
482 } // namespace internal 482 } // namespace internal
483 } // namespace v8 483 } // namespace v8
OLDNEW
« no previous file with comments | « src/type-cache.cc ('k') | src/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698