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

Side by Side Diff: src/stub-cache.cc

Issue 19663007: Avoid repeated rewrites of global store to constant IC due to store of same value. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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/code-stubs-hydrogen.cc ('k') | no next file » | 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 Isolate* isolate = cell->GetIsolate(); 556 Isolate* isolate = cell->GetIsolate();
557 Handle<Type> union_type(PropertyCell::UpdateType(cell, value), isolate); 557 Handle<Type> union_type(PropertyCell::UpdateType(cell, value), isolate);
558 bool is_constant = union_type->IsConstant(); 558 bool is_constant = union_type->IsConstant();
559 StoreGlobalStub stub(strict_mode, is_constant); 559 StoreGlobalStub stub(strict_mode, is_constant);
560 560
561 Handle<Code> code = FindIC( 561 Handle<Code> code = FindIC(
562 name, Handle<JSObject>::cast(receiver), 562 name, Handle<JSObject>::cast(receiver),
563 Code::STORE_IC, Code::NORMAL, stub.GetExtraICState()); 563 Code::STORE_IC, Code::NORMAL, stub.GetExtraICState());
564 if (!code.is_null()) return code; 564 if (!code.is_null()) return code;
565 565
566 if (is_constant) return stub.GetCode(isolate_);
567
568 // Replace the placeholder cell and global object map with the actual global 566 // Replace the placeholder cell and global object map with the actual global
569 // cell and receiver map. 567 // cell and receiver map.
570 Handle<Map> cell_map(isolate_->heap()->global_property_cell_map());
571 Handle<Map> meta_map(isolate_->heap()->meta_map()); 568 Handle<Map> meta_map(isolate_->heap()->meta_map());
572 Handle<Object> receiver_map(receiver->map(), isolate_); 569 Handle<Object> receiver_map(receiver->map(), isolate_);
573 code = stub.GetCodeCopyFromTemplate(isolate_); 570 code = stub.GetCodeCopyFromTemplate(isolate_);
574 code->ReplaceNthObject(1, *meta_map, *receiver_map); 571 code->ReplaceNthObject(1, *meta_map, *receiver_map);
572 Handle<Map> cell_map(isolate_->heap()->global_property_cell_map());
575 code->ReplaceNthObject(1, *cell_map, *cell); 573 code->ReplaceNthObject(1, *cell_map, *cell);
574
576 JSObject::UpdateMapCodeCache(receiver, name, code); 575 JSObject::UpdateMapCodeCache(receiver, name, code);
577 576
578 return code; 577 return code;
579 } 578 }
580 579
581 580
582 Handle<Code> StubCache::ComputeStoreCallback( 581 Handle<Code> StubCache::ComputeStoreCallback(
583 Handle<Name> name, 582 Handle<Name> name,
584 Handle<JSObject> receiver, 583 Handle<JSObject> receiver,
585 Handle<JSObject> holder, 584 Handle<JSObject> holder,
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 Handle<FunctionTemplateInfo>( 2201 Handle<FunctionTemplateInfo>(
2203 FunctionTemplateInfo::cast(signature->receiver())); 2202 FunctionTemplateInfo::cast(signature->receiver()));
2204 } 2203 }
2205 } 2204 }
2206 2205
2207 is_simple_api_call_ = true; 2206 is_simple_api_call_ = true;
2208 } 2207 }
2209 2208
2210 2209
2211 } } // namespace v8::internal 2210 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698