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

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

Issue 6321012: Version 3.0.9... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 11 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/version.cc » ('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 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
61 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, 64 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code,
62 Handle<Context> global_context) { 65 Handle<Context> global_context) {
63 global_context_ = global_context; 66 global_context_ = global_context;
64 Initialize(code); 67 Initialize(code);
65 } 68 }
66 69
67 70
68 void TypeFeedbackOracle::Initialize(Handle<Code> code) { 71 void TypeFeedbackOracle::Initialize(Handle<Code> code) {
69 ASSERT(map_.is_null()); // Only initialize once. 72 ASSERT(map_.is_null()); // Only initialize once.
70 map_ = Factory::NewJSObject(Top::object_function()); 73 map_ = Factory::NewJSObject(Top::object_function());
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 ZoneMapList* TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, 113 ZoneMapList* TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr,
111 Handle<String> name) { 114 Handle<String> name) {
112 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); 115 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL);
113 return CollectReceiverTypes(expr->position(), name, flags); 116 return CollectReceiverTypes(expr->position(), name, flags);
114 } 117 }
115 118
116 119
117 ZoneMapList* TypeFeedbackOracle::CallReceiverTypes(Call* expr, 120 ZoneMapList* TypeFeedbackOracle::CallReceiverTypes(Call* expr,
118 Handle<String> name) { 121 Handle<String> name) {
119 int arity = expr->arguments()->length(); 122 int arity = expr->arguments()->length();
120 Code::Flags flags = Code::ComputeMonomorphicFlags( 123 // Note: these flags won't let us get maps from stubs with
121 Code::CALL_IC, NORMAL, OWN_MAP, NOT_IN_LOOP, arity); 124 // non-default extra ic state in the megamorphic case. In the more
125 // important monomorphic case the map is obtained directly, so it's
126 // not a problem until we decide to emit more polymorphic code.
127 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC,
128 NORMAL,
129 Code::kNoExtraICState,
130 OWN_MAP,
131 NOT_IN_LOOP,
132 arity);
122 return CollectReceiverTypes(expr->position(), name, flags); 133 return CollectReceiverTypes(expr->position(), name, flags);
123 } 134 }
124 135
125 136
126 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { 137 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) {
127 Handle<Object> value = GetElement(map_, expr->position()); 138 Handle<Object> value = GetElement(map_, expr->position());
128 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; 139 if (!value->IsSmi()) return RECEIVER_MAP_CHECK;
129 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); 140 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value());
130 ASSERT(check != RECEIVER_MAP_CHECK); 141 ASSERT(check != RECEIVER_MAP_CHECK);
131 return check; 142 return check;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 source_positions->Add(position); 397 source_positions->Add(position);
387 } 398 }
388 } else { 399 } else {
389 ASSERT(RelocInfo::IsPosition(mode)); 400 ASSERT(RelocInfo::IsPosition(mode));
390 position = static_cast<int>(info->data()); 401 position = static_cast<int>(info->data());
391 } 402 }
392 } 403 }
393 } 404 }
394 405
395 } } // namespace v8::internal 406 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698