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

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

Issue 16925008: Generate StoreGlobal stubs with Hydrogen (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address feedback 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
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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 Handle<Code> StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) { 492 Handle<Code> StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) {
493 return (strict_mode == kStrictMode) 493 return (strict_mode == kStrictMode)
494 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict() 494 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict()
495 : isolate_->builtins()->Builtins::StoreIC_Normal(); 495 : isolate_->builtins()->Builtins::StoreIC_Normal();
496 } 496 }
497 497
498 498
499 Handle<Code> StubCache::ComputeStoreGlobal(Handle<Name> name, 499 Handle<Code> StubCache::ComputeStoreGlobal(Handle<Name> name,
500 Handle<GlobalObject> receiver, 500 Handle<GlobalObject> receiver,
501 Handle<PropertyCell> cell, 501 Handle<PropertyCell> cell,
502 Handle<Object> value,
502 StrictModeFlag strict_mode) { 503 StrictModeFlag strict_mode) {
503 Handle<Code> stub = FindIC( 504 Isolate* isolate = cell->GetIsolate();
505 Handle<Type> union_type(PropertyCell::UpdateType(cell, value), isolate);
506 bool is_constant = union_type->IsConstant();
507 StoreGlobalStub stub(strict_mode, is_constant);
508
509 Handle<Code> code = FindIC(
504 name, Handle<JSObject>::cast(receiver), 510 name, Handle<JSObject>::cast(receiver),
505 Code::STORE_IC, Code::NORMAL, strict_mode); 511 Code::STORE_IC, Code::NORMAL, stub.GetExtraICState());
506 if (!stub.is_null()) return stub; 512 if (!code.is_null()) return code;
507 513
508 StoreStubCompiler compiler(isolate_, strict_mode); 514 if (is_constant) return stub.GetCode(isolate_);
509 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name); 515
516 // Replace the placeholder cell and global object map with the actual global
517 // cell and receiver map.
518 Handle<Map> cell_map(isolate_->heap()->global_property_cell_map());
519 Handle<Map> meta_map(isolate_->heap()->meta_map());
520 Handle<Object> receiver_map(receiver->map(), isolate_);
521 code = stub.GetCodeCopyFromTemplate(isolate_);
522 code->ReplaceNthObject(1, *meta_map, *receiver_map);
523 code->ReplaceNthObject(1, *cell_map, *cell);
510 JSObject::UpdateMapCodeCache(receiver, name, code); 524 JSObject::UpdateMapCodeCache(receiver, name, code);
525
511 return code; 526 return code;
512 } 527 }
513 528
514 529
515 Handle<Code> StubCache::ComputeStoreCallback( 530 Handle<Code> StubCache::ComputeStoreCallback(
516 Handle<Name> name, 531 Handle<Name> name,
517 Handle<JSObject> receiver, 532 Handle<JSObject> receiver,
518 Handle<JSObject> holder, 533 Handle<JSObject> holder,
519 Handle<ExecutableAccessorInfo> callback, 534 Handle<ExecutableAccessorInfo> callback,
520 StrictModeFlag strict_mode) { 535 StrictModeFlag strict_mode) {
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 930
916 Handle<Code> StubCache::ComputeCompareNil(Handle<Map> receiver_map, 931 Handle<Code> StubCache::ComputeCompareNil(Handle<Map> receiver_map,
917 CompareNilICStub& stub) { 932 CompareNilICStub& stub) {
918 Handle<String> name(isolate_->heap()->empty_string()); 933 Handle<String> name(isolate_->heap()->empty_string());
919 if (!receiver_map->is_shared()) { 934 if (!receiver_map->is_shared()) {
920 Handle<Code> cached_ic = FindIC(name, receiver_map, Code::COMPARE_NIL_IC, 935 Handle<Code> cached_ic = FindIC(name, receiver_map, Code::COMPARE_NIL_IC,
921 Code::NORMAL, stub.GetExtraICState()); 936 Code::NORMAL, stub.GetExtraICState());
922 if (!cached_ic.is_null()) return cached_ic; 937 if (!cached_ic.is_null()) return cached_ic;
923 } 938 }
924 939
925 Handle<Code> ic = stub.GetCode(isolate_); 940 Handle<Code> ic = stub.GetCodeCopyFromTemplate(isolate_);
926 941 ic->ReplaceNthObject(1, isolate_->heap()->meta_map(), *receiver_map);
927 // For monomorphic maps, use the code as a template, copying and replacing
928 // the monomorphic map that checks the object's type.
929 ic = isolate_->factory()->CopyCode(ic);
930 ic->ReplaceFirstMap(*receiver_map);
931 942
932 if (!receiver_map->is_shared()) { 943 if (!receiver_map->is_shared()) {
933 Map::UpdateCodeCache(receiver_map, name, ic); 944 Map::UpdateCodeCache(receiver_map, name, ic);
934 } 945 }
935 946
936 return ic; 947 return ic;
937 } 948 }
938 949
939 950
940 Handle<Code> StubCache::ComputeLoadElementPolymorphic( 951 Handle<Code> StubCache::ComputeLoadElementPolymorphic(
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 Handle<FunctionTemplateInfo>( 2112 Handle<FunctionTemplateInfo>(
2102 FunctionTemplateInfo::cast(signature->receiver())); 2113 FunctionTemplateInfo::cast(signature->receiver()));
2103 } 2114 }
2104 } 2115 }
2105 2116
2106 is_simple_api_call_ = true; 2117 is_simple_api_call_ = true;
2107 } 2118 }
2108 2119
2109 2120
2110 } } // namespace v8::internal 2121 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/code-stubs-x64.cc » ('j') | src/x64/lithium-gap-resolver-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698