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

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

Issue 106453003: Allocation site support for monomorphic StringAdds in BinaryOps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 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/typing.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 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 *left_type = *right_type = stub.GetInputType(isolate_, map); 276 *left_type = *right_type = stub.GetInputType(isolate_, map);
277 } 277 }
278 } 278 }
279 279
280 280
281 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, 281 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id,
282 Handle<Type>* left, 282 Handle<Type>* left,
283 Handle<Type>* right, 283 Handle<Type>* right,
284 Handle<Type>* result, 284 Handle<Type>* result,
285 Maybe<int>* fixed_right_arg, 285 Maybe<int>* fixed_right_arg,
286 Handle<AllocationSite>* allocation_site,
286 Token::Value op) { 287 Token::Value op) {
287 Handle<Object> object = GetInfo(id); 288 Handle<Object> object = GetInfo(id);
288 if (!object->IsCode()) { 289 if (!object->IsCode()) {
289 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the 290 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the
290 // operations covered by the BinaryOpIC we should always have them. 291 // operations covered by the BinaryOpIC we should always have them.
291 ASSERT(op < BinaryOpIC::State::FIRST_TOKEN || 292 ASSERT(op < BinaryOpIC::State::FIRST_TOKEN ||
292 op > BinaryOpIC::State::LAST_TOKEN); 293 op > BinaryOpIC::State::LAST_TOKEN);
293 *left = *right = *result = handle(Type::None(), isolate_); 294 *left = *right = *result = handle(Type::None(), isolate_);
294 *fixed_right_arg = Maybe<int>(); 295 *fixed_right_arg = Maybe<int>();
296 *allocation_site = Handle<AllocationSite>::null();
295 return; 297 return;
296 } 298 }
297 Handle<Code> code = Handle<Code>::cast(object); 299 Handle<Code> code = Handle<Code>::cast(object);
298 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); 300 ASSERT_EQ(Code::BINARY_OP_IC, code->kind());
299 BinaryOpIC::State state(code->extended_extra_ic_state()); 301 BinaryOpIC::State state(code->extended_extra_ic_state());
300 ASSERT_EQ(op, state.op()); 302 ASSERT_EQ(op, state.op());
301 303
302 *left = state.GetLeftType(isolate()); 304 *left = state.GetLeftType(isolate());
303 *right = state.GetRightType(isolate()); 305 *right = state.GetRightType(isolate());
304 *result = state.GetResultType(isolate()); 306 *result = state.GetResultType(isolate());
305 *fixed_right_arg = state.fixed_right_arg(); 307 *fixed_right_arg = state.fixed_right_arg();
308
309 AllocationSite* first_allocation_site = code->FindFirstAllocationSite();
310 if (first_allocation_site != NULL) {
311 *allocation_site = handle(first_allocation_site);
312 } else {
313 *allocation_site = Handle<AllocationSite>::null();
314 }
306 } 315 }
307 316
308 317
309 Handle<Type> TypeFeedbackOracle::CountType(TypeFeedbackId id) { 318 Handle<Type> TypeFeedbackOracle::CountType(TypeFeedbackId id) {
310 Handle<Object> object = GetInfo(id); 319 Handle<Object> object = GetInfo(id);
311 if (!object->IsCode()) return handle(Type::None(), isolate_); 320 if (!object->IsCode()) return handle(Type::None(), isolate_);
312 Handle<Code> code = Handle<Code>::cast(object); 321 Handle<Code> code = Handle<Code>::cast(object);
313 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); 322 ASSERT_EQ(Code::BINARY_OP_IC, code->kind());
314 BinaryOpIC::State state(code->extended_extra_ic_state()); 323 BinaryOpIC::State state(code->extended_extra_ic_state());
315 return state.GetLeftType(isolate()); 324 return state.GetLeftType(isolate());
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 #ifdef DEBUG 575 #ifdef DEBUG
567 Object* result = NULL; 576 Object* result = NULL;
568 // Dictionary has been allocated with sufficient size for all elements. 577 // Dictionary has been allocated with sufficient size for all elements.
569 ASSERT(maybe_result->ToObject(&result)); 578 ASSERT(maybe_result->ToObject(&result));
570 ASSERT(*dictionary_ == result); 579 ASSERT(*dictionary_ == result);
571 #endif 580 #endif
572 } 581 }
573 582
574 583
575 } } // namespace v8::internal 584 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | src/typing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698