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

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

Issue 6664001: [Isolates] Merge (7083,7111] from bleeding_edge. (Closed)
Patch Set: Created 9 years, 9 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-info.h ('k') | src/v8-counters.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 Handle<Object> TypeFeedbackOracle::GetInfo(int pos) { 72 Handle<Object> TypeFeedbackOracle::GetInfo(int pos) {
73 int entry = dictionary_->FindEntry(pos); 73 int entry = dictionary_->FindEntry(pos);
74 return entry != NumberDictionary::kNotFound 74 return entry != NumberDictionary::kNotFound
75 ? Handle<Object>(dictionary_->ValueAt(entry)) 75 ? Handle<Object>(dictionary_->ValueAt(entry))
76 : Isolate::Current()->factory()->undefined_value(); 76 : Isolate::Current()->factory()->undefined_value();
77 } 77 }
78 78
79 79
80 bool TypeFeedbackOracle::LoadIsMonomorphic(Property* expr) { 80 bool TypeFeedbackOracle::LoadIsMonomorphic(Property* expr) {
81 return GetInfo(expr->position())->IsMap(); 81 Handle<Object> map_or_code(GetInfo(expr->position()));
82 if (map_or_code->IsMap()) return true;
83 if (map_or_code->IsCode()) {
84 Handle<Code> code(Code::cast(*map_or_code));
85 return code->kind() == Code::KEYED_EXTERNAL_ARRAY_LOAD_IC &&
86 code->FindFirstMap() != NULL;
87 }
88 return false;
82 } 89 }
83 90
84 91
85 bool TypeFeedbackOracle:: StoreIsMonomorphic(Assignment* expr) { 92 bool TypeFeedbackOracle::StoreIsMonomorphic(Assignment* expr) {
86 return GetInfo(expr->position())->IsMap(); 93 Handle<Object> map_or_code(GetInfo(expr->position()));
94 if (map_or_code->IsMap()) return true;
95 if (map_or_code->IsCode()) {
96 Handle<Code> code(Code::cast(*map_or_code));
97 return code->kind() == Code::KEYED_EXTERNAL_ARRAY_STORE_IC &&
98 code->FindFirstMap() != NULL;
99 }
100 return false;
87 } 101 }
88 102
89 103
90 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { 104 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) {
91 Handle<Object> value = GetInfo(expr->position()); 105 Handle<Object> value = GetInfo(expr->position());
92 return value->IsMap() || value->IsSmi(); 106 return value->IsMap() || value->IsSmi();
93 } 107 }
94 108
95 109
96 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { 110 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) {
97 ASSERT(LoadIsMonomorphic(expr)); 111 ASSERT(LoadIsMonomorphic(expr));
98 return Handle<Map>::cast(GetInfo(expr->position())); 112 Handle<Object> map_or_code(
113 Handle<HeapObject>::cast(GetInfo(expr->position())));
114 if (map_or_code->IsCode()) {
115 Handle<Code> code(Code::cast(*map_or_code));
116 return Handle<Map>(code->FindFirstMap());
117 }
118 return Handle<Map>(Map::cast(*map_or_code));
99 } 119 }
100 120
101 121
102 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Assignment* expr) { 122 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Assignment* expr) {
103 ASSERT(StoreIsMonomorphic(expr)); 123 ASSERT(StoreIsMonomorphic(expr));
104 return Handle<Map>::cast(GetInfo(expr->position())); 124 Handle<HeapObject> map_or_code(
125 Handle<HeapObject>::cast(GetInfo(expr->position())));
126 if (map_or_code->IsCode()) {
127 Handle<Code> code(Code::cast(*map_or_code));
128 return Handle<Map>(code->FindFirstMap());
129 }
130 return Handle<Map>(Map::cast(*map_or_code));
105 } 131 }
106 132
107 133
108 ZoneMapList* TypeFeedbackOracle::LoadReceiverTypes(Property* expr, 134 ZoneMapList* TypeFeedbackOracle::LoadReceiverTypes(Property* expr,
109 Handle<String> name) { 135 Handle<String> name) {
110 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); 136 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL);
111 return CollectReceiverTypes(expr->position(), name, flags); 137 return CollectReceiverTypes(expr->position(), name, flags);
112 } 138 }
113 139
114 140
(...skipping 22 matching lines...) Expand all
137 163
138 164
139 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { 165 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) {
140 Handle<Object> value = GetInfo(expr->position()); 166 Handle<Object> value = GetInfo(expr->position());
141 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; 167 if (!value->IsSmi()) return RECEIVER_MAP_CHECK;
142 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); 168 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value());
143 ASSERT(check != RECEIVER_MAP_CHECK); 169 ASSERT(check != RECEIVER_MAP_CHECK);
144 return check; 170 return check;
145 } 171 }
146 172
173 ExternalArrayType TypeFeedbackOracle::GetKeyedLoadExternalArrayType(
174 Property* expr) {
175 Handle<Object> stub = GetInfo(expr->position());
176 ASSERT(stub->IsCode());
177 return Code::cast(*stub)->external_array_type();
178 }
179
180 ExternalArrayType TypeFeedbackOracle::GetKeyedStoreExternalArrayType(
181 Assignment* expr) {
182 Handle<Object> stub = GetInfo(expr->position());
183 ASSERT(stub->IsCode());
184 return Code::cast(*stub)->external_array_type();
185 }
147 186
148 Handle<JSObject> TypeFeedbackOracle::GetPrototypeForPrimitiveCheck( 187 Handle<JSObject> TypeFeedbackOracle::GetPrototypeForPrimitiveCheck(
149 CheckType check) { 188 CheckType check) {
150 JSFunction* function = NULL; 189 JSFunction* function = NULL;
151 switch (check) { 190 switch (check) {
152 case RECEIVER_MAP_CHECK: 191 case RECEIVER_MAP_CHECK:
153 UNREACHABLE(); 192 UNREACHABLE();
154 break; 193 break;
155 case STRING_CHECK: 194 case STRING_CHECK:
156 function = global_context_->string_function(); 195 function = global_context_->string_function();
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 kind == Code::TYPE_RECORDING_BINARY_OP_IC || 383 kind == Code::TYPE_RECORDING_BINARY_OP_IC ||
345 kind == Code::COMPARE_IC) { 384 kind == Code::COMPARE_IC) {
346 // TODO(kasperl): Avoid having multiple ICs with the same 385 // TODO(kasperl): Avoid having multiple ICs with the same
347 // position by making sure that we have position information 386 // position by making sure that we have position information
348 // recorded for all binary ICs. 387 // recorded for all binary ICs.
349 int entry = dictionary_->FindEntry(position); 388 int entry = dictionary_->FindEntry(position);
350 if (entry == NumberDictionary::kNotFound) { 389 if (entry == NumberDictionary::kNotFound) {
351 value = target; 390 value = target;
352 } 391 }
353 } else if (state == MONOMORPHIC) { 392 } else if (state == MONOMORPHIC) {
354 if (target->kind() != Code::CALL_IC || 393 if (kind == Code::KEYED_EXTERNAL_ARRAY_LOAD_IC ||
394 kind == Code::KEYED_EXTERNAL_ARRAY_STORE_IC) {
395 value = target;
396 } else if (target->kind() != Code::CALL_IC ||
355 target->check_type() == RECEIVER_MAP_CHECK) { 397 target->check_type() == RECEIVER_MAP_CHECK) {
356 Map* map = target->FindFirstMap(); 398 Map* map = target->FindFirstMap();
357 if (map == NULL) { 399 if (map == NULL) {
358 value = target; 400 value = target;
359 } else { 401 } else {
360 value = Handle<Map>(map); 402 value = Handle<Map>(map);
361 } 403 }
362 } else { 404 } else {
363 ASSERT(target->kind() == Code::CALL_IC); 405 ASSERT(target->kind() == Code::CALL_IC);
364 CheckType check = target->check_type(); 406 CheckType check = target->check_type();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 source_positions->Add(position); 458 source_positions->Add(position);
417 } 459 }
418 } else { 460 } else {
419 ASSERT(RelocInfo::IsPosition(mode)); 461 ASSERT(RelocInfo::IsPosition(mode));
420 position = static_cast<int>(info->data()); 462 position = static_cast<int>(info->data());
421 } 463 }
422 } 464 }
423 } 465 }
424 466
425 } } // namespace v8::internal 467 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698