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

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

Issue 7039036: Fix calls of strict mode function with an implicit receiver. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments. 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/type-info.h ('k') | src/utils.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 : TypeInfo::Double(); 51 : TypeInfo::Double();
52 } else if (value->IsString()) { 52 } else if (value->IsString()) {
53 info = TypeInfo::String(); 53 info = TypeInfo::String();
54 } else { 54 } else {
55 info = TypeInfo::Unknown(); 55 info = TypeInfo::Unknown();
56 } 56 }
57 return info; 57 return info;
58 } 58 }
59 59
60 60
61 STATIC_ASSERT(DEFAULT_STRING_STUB == Code::kNoExtraICState);
62
63
64 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, 61 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code,
65 Handle<Context> global_context) { 62 Handle<Context> global_context) {
66 global_context_ = global_context; 63 global_context_ = global_context;
67 PopulateMap(code); 64 PopulateMap(code);
68 ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue); 65 ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue);
69 } 66 }
70 67
71 68
72 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { 69 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) {
73 int entry = dictionary_->FindEntry(ast_id); 70 int entry = dictionary_->FindEntry(ast_id);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 137
141 138
142 ZoneMapList* TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, 139 ZoneMapList* TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr,
143 Handle<String> name) { 140 Handle<String> name) {
144 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); 141 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL);
145 return CollectReceiverTypes(expr->id(), name, flags); 142 return CollectReceiverTypes(expr->id(), name, flags);
146 } 143 }
147 144
148 145
149 ZoneMapList* TypeFeedbackOracle::CallReceiverTypes(Call* expr, 146 ZoneMapList* TypeFeedbackOracle::CallReceiverTypes(Call* expr,
150 Handle<String> name) { 147 Handle<String> name,
148 CallKind call_kind) {
151 int arity = expr->arguments()->length(); 149 int arity = expr->arguments()->length();
152 // Note: these flags won't let us get maps from stubs with 150
153 // non-default extra ic state in the megamorphic case. In the more 151 // Note: Currently we do not take string extra ic data into account
154 // important monomorphic case the map is obtained directly, so it's 152 // here.
155 // not a problem until we decide to emit more polymorphic code. 153 Code::ExtraICState extra_ic_state =
154 CallIC::Contextual::encode(call_kind == CALL_AS_FUNCTION);
155
156 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, 156 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC,
157 NORMAL, 157 NORMAL,
158 Code::kNoExtraICState, 158 extra_ic_state,
159 OWN_MAP, 159 OWN_MAP,
160 NOT_IN_LOOP, 160 NOT_IN_LOOP,
161 arity); 161 arity);
162 return CollectReceiverTypes(expr->id(), name, flags); 162 return CollectReceiverTypes(expr->id(), name, flags);
163 } 163 }
164 164
165 165
166 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { 166 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) {
167 Handle<Object> value = GetInfo(expr->id()); 167 Handle<Object> value = GetInfo(expr->id());
168 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; 168 if (!value->IsSmi()) return RECEIVER_MAP_CHECK;
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 static_cast<int>(info->pc() - code->instruction_start())); 498 static_cast<int>(info->pc() - code->instruction_start()));
499 ASSERT(ast_ids->length() == 0 || 499 ASSERT(ast_ids->length() == 0 ||
500 (*ast_ids)[ast_ids->length()-1] != 500 (*ast_ids)[ast_ids->length()-1] !=
501 static_cast<unsigned>(info->data())); 501 static_cast<unsigned>(info->data()));
502 ast_ids->Add(static_cast<unsigned>(info->data())); 502 ast_ids->Add(static_cast<unsigned>(info->data()));
503 } 503 }
504 } 504 }
505 } 505 }
506 506
507 } } // namespace v8::internal 507 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698