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

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

Issue 6894003: Better support for 'polymorphic' JS and external arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: final review feedback Created 9 years, 7 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/stub-cache.cc ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 Handle<Object> map_or_code(GetInfo(expr->id())); 81 Handle<Object> map_or_code(GetInfo(expr->id()));
82 if (map_or_code->IsMap()) return true; 82 if (map_or_code->IsMap()) return true;
83 if (map_or_code->IsCode()) { 83 if (map_or_code->IsCode()) {
84 Handle<Code> code(Code::cast(*map_or_code)); 84 Handle<Code> code(Code::cast(*map_or_code));
85 return code->kind() == Code::KEYED_EXTERNAL_ARRAY_LOAD_IC && 85 return code->is_keyed_load_stub() &&
86 code->ic_state() == MONOMORPHIC &&
86 code->FindFirstMap() != NULL; 87 code->FindFirstMap() != NULL;
87 } 88 }
88 return false; 89 return false;
89 } 90 }
90 91
91 92
92 bool TypeFeedbackOracle::StoreIsMonomorphic(Expression* expr) { 93 bool TypeFeedbackOracle::StoreIsMonomorphic(Expression* expr) {
93 Handle<Object> map_or_code(GetInfo(expr->id())); 94 Handle<Object> map_or_code(GetInfo(expr->id()));
94 if (map_or_code->IsMap()) return true; 95 if (map_or_code->IsMap()) return true;
95 if (map_or_code->IsCode()) { 96 if (map_or_code->IsCode()) {
96 Handle<Code> code(Code::cast(*map_or_code)); 97 Handle<Code> code(Code::cast(*map_or_code));
97 return code->kind() == Code::KEYED_EXTERNAL_ARRAY_STORE_IC && 98 return code->is_keyed_store_stub() &&
98 code->FindFirstMap() != NULL; 99 code->ic_state() == MONOMORPHIC;
99 } 100 }
100 return false; 101 return false;
101 } 102 }
102 103
103 104
104 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { 105 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) {
105 Handle<Object> value = GetInfo(expr->id()); 106 Handle<Object> value = GetInfo(expr->id());
106 return value->IsMap() || value->IsSmi(); 107 return value->IsMap() || value->IsSmi();
107 } 108 }
108 109
109 110
110 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { 111 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) {
111 ASSERT(LoadIsMonomorphic(expr)); 112 ASSERT(LoadIsMonomorphic(expr));
112 Handle<Object> map_or_code( 113 Handle<Object> map_or_code(
113 Handle<HeapObject>::cast(GetInfo(expr->id()))); 114 Handle<HeapObject>::cast(GetInfo(expr->id())));
114 if (map_or_code->IsCode()) { 115 if (map_or_code->IsCode()) {
115 Handle<Code> code(Code::cast(*map_or_code)); 116 Handle<Code> code(Code::cast(*map_or_code));
116 return Handle<Map>(code->FindFirstMap()); 117 Map* first_map = code->FindFirstMap();
118 ASSERT(first_map != NULL);
119 return Handle<Map>(first_map);
117 } 120 }
118 return Handle<Map>(Map::cast(*map_or_code)); 121 return Handle<Map>(Map::cast(*map_or_code));
119 } 122 }
120 123
121 124
122 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Expression* expr) { 125 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Expression* expr) {
123 ASSERT(StoreIsMonomorphic(expr)); 126 ASSERT(StoreIsMonomorphic(expr));
124 Handle<HeapObject> map_or_code( 127 Handle<HeapObject> map_or_code(
125 Handle<HeapObject>::cast(GetInfo(expr->id()))); 128 Handle<HeapObject>::cast(GetInfo(expr->id())));
126 if (map_or_code->IsCode()) { 129 if (map_or_code->IsCode()) {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 Code* target = Code::GetCodeFromTargetAddress(info.target_address()); 441 Code* target = Code::GetCodeFromTargetAddress(info.target_address());
439 unsigned id = ast_ids[i]; 442 unsigned id = ast_ids[i];
440 InlineCacheState state = target->ic_state(); 443 InlineCacheState state = target->ic_state();
441 Code::Kind kind = target->kind(); 444 Code::Kind kind = target->kind();
442 445
443 if (kind == Code::TYPE_RECORDING_BINARY_OP_IC || 446 if (kind == Code::TYPE_RECORDING_BINARY_OP_IC ||
444 kind == Code::TYPE_RECORDING_UNARY_OP_IC || 447 kind == Code::TYPE_RECORDING_UNARY_OP_IC ||
445 kind == Code::COMPARE_IC) { 448 kind == Code::COMPARE_IC) {
446 SetInfo(id, target); 449 SetInfo(id, target);
447 } else if (state == MONOMORPHIC) { 450 } else if (state == MONOMORPHIC) {
448 if (kind == Code::KEYED_EXTERNAL_ARRAY_LOAD_IC || 451 if (kind == Code::KEYED_LOAD_IC ||
449 kind == Code::KEYED_EXTERNAL_ARRAY_STORE_IC) { 452 kind == Code::KEYED_STORE_IC) {
450 SetInfo(id, target); 453 SetInfo(id, target);
451 } else if (kind != Code::CALL_IC || 454 } else if (kind != Code::CALL_IC ||
452 target->check_type() == RECEIVER_MAP_CHECK) { 455 target->check_type() == RECEIVER_MAP_CHECK) {
453 Map* map = target->FindFirstMap(); 456 Map* map = target->FindFirstMap();
454 if (map == NULL) { 457 if (map == NULL) {
455 SetInfo(id, target); 458 SetInfo(id, target);
456 } else { 459 } else {
457 SetInfo(id, map); 460 SetInfo(id, map);
458 } 461 }
459 } else { 462 } else {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 static_cast<int>(info->pc() - code->instruction_start())); 500 static_cast<int>(info->pc() - code->instruction_start()));
498 ASSERT(ast_ids->length() == 0 || 501 ASSERT(ast_ids->length() == 0 ||
499 (*ast_ids)[ast_ids->length()-1] != 502 (*ast_ids)[ast_ids->length()-1] !=
500 static_cast<unsigned>(info->data())); 503 static_cast<unsigned>(info->data()));
501 ast_ids->Add(static_cast<unsigned>(info->data())); 504 ast_ids->Add(static_cast<unsigned>(info->data()));
502 } 505 }
503 } 506 }
504 } 507 }
505 508
506 } } // namespace v8::internal 509 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.cc ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698