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

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

Issue 110573004: Merge bleeding_edge 17696:18016. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 return code->is_keyed_store_stub() && 193 return code->is_keyed_store_stub() &&
194 code->ic_state() == POLYMORPHIC; 194 code->ic_state() == POLYMORPHIC;
195 } 195 }
196 return false; 196 return false;
197 } 197 }
198 198
199 199
200 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { 200 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) {
201 Handle<Object> value = GetInfo(expr->CallFeedbackId()); 201 Handle<Object> value = GetInfo(expr->CallFeedbackId());
202 return value->IsMap() || value->IsAllocationSite() || value->IsJSFunction() || 202 return value->IsMap() || value->IsAllocationSite() || value->IsJSFunction() ||
203 value->IsSmi(); 203 value->IsSmi() ||
204 (value->IsCode() && Handle<Code>::cast(value)->ic_state() == MONOMORPHIC);
204 } 205 }
205 206
206 207
208 bool TypeFeedbackOracle::KeyedArrayCallIsHoley(Call* expr) {
209 Handle<Object> value = GetInfo(expr->CallFeedbackId());
210 Handle<Code> code = Handle<Code>::cast(value);
211 return KeyedArrayCallStub::IsHoley(code);
212 }
213
214
207 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { 215 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) {
208 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); 216 Handle<Object> info = GetInfo(expr->CallNewFeedbackId());
209 return info->IsAllocationSite() || info->IsJSFunction(); 217 return info->IsAllocationSite() || info->IsJSFunction();
210 } 218 }
211 219
212 220
213 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( 221 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic(
214 ObjectLiteral::Property* prop) { 222 ObjectLiteral::Property* prop) {
215 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); 223 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId());
216 return map_or_code->IsMap(); 224 return map_or_code->IsMap();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 Handle<String> name, 299 Handle<String> name,
292 CallKind call_kind, 300 CallKind call_kind,
293 SmallMapList* types) { 301 SmallMapList* types) {
294 int arity = expr->arguments()->length(); 302 int arity = expr->arguments()->length();
295 303
296 // Note: Currently we do not take string extra ic data into account 304 // Note: Currently we do not take string extra ic data into account
297 // here. 305 // here.
298 Code::ExtraICState extra_ic_state = 306 Code::ExtraICState extra_ic_state =
299 CallIC::Contextual::encode(call_kind == CALL_AS_FUNCTION); 307 CallIC::Contextual::encode(call_kind == CALL_AS_FUNCTION);
300 308
301 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, 309 Code::Flags flags = Code::ComputeMonomorphicFlags(
302 extra_ic_state, 310 Code::CALL_IC, extra_ic_state, OWN_MAP, Code::NORMAL, arity);
303 Code::NORMAL,
304 arity,
305 OWN_MAP);
306 CollectReceiverTypes(expr->CallFeedbackId(), name, flags, types); 311 CollectReceiverTypes(expr->CallFeedbackId(), name, flags, types);
307 } 312 }
308 313
309 314
310 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { 315 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) {
311 Handle<Object> value = GetInfo(expr->CallFeedbackId()); 316 Handle<Object> value = GetInfo(expr->CallFeedbackId());
312 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; 317 if (!value->IsSmi()) return RECEIVER_MAP_CHECK;
313 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); 318 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value());
314 ASSERT(check != RECEIVER_MAP_CHECK); 319 ASSERT(check != RECEIVER_MAP_CHECK);
315 return check; 320 return check;
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 for (int i = 0; i < infos->length(); i++) { 618 for (int i = 0; i < infos->length(); i++) {
614 RelocInfo reloc_entry = (*infos)[i]; 619 RelocInfo reloc_entry = (*infos)[i];
615 Address target_address = reloc_entry.target_address(); 620 Address target_address = reloc_entry.target_address();
616 TypeFeedbackId ast_id = 621 TypeFeedbackId ast_id =
617 TypeFeedbackId(static_cast<unsigned>((*infos)[i].data())); 622 TypeFeedbackId(static_cast<unsigned>((*infos)[i].data()));
618 Code* target = Code::GetCodeFromTargetAddress(target_address); 623 Code* target = Code::GetCodeFromTargetAddress(target_address);
619 switch (target->kind()) { 624 switch (target->kind()) {
620 case Code::LOAD_IC: 625 case Code::LOAD_IC:
621 case Code::STORE_IC: 626 case Code::STORE_IC:
622 case Code::CALL_IC: 627 case Code::CALL_IC:
623 case Code::KEYED_CALL_IC:
624 if (target->ic_state() == MONOMORPHIC) { 628 if (target->ic_state() == MONOMORPHIC) {
625 if (target->kind() == Code::CALL_IC && 629 if (target->kind() == Code::CALL_IC &&
626 target->check_type() != RECEIVER_MAP_CHECK) { 630 target->check_type() != RECEIVER_MAP_CHECK) {
627 SetInfo(ast_id, Smi::FromInt(target->check_type())); 631 SetInfo(ast_id, Smi::FromInt(target->check_type()));
628 } else { 632 } else {
629 Object* map = target->FindFirstMap(); 633 Object* map = target->FindFirstMap();
630 if (map == NULL) { 634 if (map == NULL) {
631 SetInfo(ast_id, static_cast<Object*>(target)); 635 SetInfo(ast_id, static_cast<Object*>(target));
632 } else if (!CanRetainOtherContext(Map::cast(map), 636 } else if (!CanRetainOtherContext(Map::cast(map),
633 *native_context_)) { 637 *native_context_)) {
634 Map* feedback = Map::cast(map)->CurrentMapForDeprecated(); 638 Map* feedback = Map::cast(map)->CurrentMapForDeprecated();
635 if (feedback != NULL) SetInfo(ast_id, feedback); 639 if (feedback != NULL) SetInfo(ast_id, feedback);
636 } 640 }
637 } 641 }
638 } else { 642 } else {
639 SetInfo(ast_id, target); 643 SetInfo(ast_id, target);
640 } 644 }
641 break; 645 break;
642 646
647 case Code::KEYED_CALL_IC:
643 case Code::KEYED_LOAD_IC: 648 case Code::KEYED_LOAD_IC:
644 case Code::KEYED_STORE_IC: 649 case Code::KEYED_STORE_IC:
645 case Code::BINARY_OP_IC: 650 case Code::BINARY_OP_IC:
646 case Code::COMPARE_IC: 651 case Code::COMPARE_IC:
647 case Code::TO_BOOLEAN_IC: 652 case Code::TO_BOOLEAN_IC:
648 case Code::COMPARE_NIL_IC: 653 case Code::COMPARE_NIL_IC:
649 SetInfo(ast_id, target); 654 SetInfo(ast_id, target);
650 break; 655 break;
651 656
652 default: 657 default:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 if (info.IsUninitialized()) return Representation::None(); 699 if (info.IsUninitialized()) return Representation::None();
695 if (info.IsSmi()) return Representation::Smi(); 700 if (info.IsSmi()) return Representation::Smi();
696 if (info.IsInteger32()) return Representation::Integer32(); 701 if (info.IsInteger32()) return Representation::Integer32();
697 if (info.IsDouble()) return Representation::Double(); 702 if (info.IsDouble()) return Representation::Double();
698 if (info.IsNumber()) return Representation::Double(); 703 if (info.IsNumber()) return Representation::Double();
699 return Representation::Tagged(); 704 return Representation::Tagged();
700 } 705 }
701 706
702 707
703 } } // namespace v8::internal 708 } } // namespace v8::internal
OLDNEW
« include/v8-platform.h ('K') | « src/type-info.h ('k') | src/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698