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

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

Issue 132373011: A64: Synchronize with r17635. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/stub-cache.h ('k') | src/typedarray.js » ('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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 if (!handler.is_null()) return handler; 195 if (!handler.is_null()) return handler;
196 196
197 LoadStubCompiler compiler(isolate_); 197 LoadStubCompiler compiler(isolate_);
198 handler = 198 handler =
199 compiler.CompileLoadNonexistent(receiver, current, cache_name, global); 199 compiler.CompileLoadNonexistent(receiver, current, cache_name, global);
200 HeapObject::UpdateMapCodeCache(receiver, cache_name, handler); 200 HeapObject::UpdateMapCodeCache(receiver, cache_name, handler);
201 return handler; 201 return handler;
202 } 202 }
203 203
204 204
205 Handle<Code> StubCache::ComputeLoadGlobal(Handle<Name> name,
206 Handle<JSObject> receiver,
207 Handle<GlobalObject> holder,
208 Handle<PropertyCell> cell,
209 bool is_dont_delete) {
210 Handle<Code> stub = FindIC(name, receiver, Code::LOAD_IC);
211 if (!stub.is_null()) return stub;
212
213 LoadStubCompiler compiler(isolate_);
214 Handle<Code> ic =
215 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete);
216 HeapObject::UpdateMapCodeCache(receiver, name, ic);
217 return ic;
218 }
219
220
221 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) { 205 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) {
222 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC); 206 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC);
223 Handle<Name> name = 207 Handle<Name> name =
224 isolate()->factory()->KeyedLoadElementMonomorphic_string(); 208 isolate()->factory()->KeyedLoadElementMonomorphic_string();
225 209
226 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); 210 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_);
227 if (probe->IsCode()) return Handle<Code>::cast(probe); 211 if (probe->IsCode()) return Handle<Code>::cast(probe);
228 212
229 KeyedLoadStubCompiler compiler(isolate()); 213 KeyedLoadStubCompiler compiler(isolate());
230 Handle<Code> code = compiler.CompileLoadElement(receiver_map); 214 Handle<Code> code = compiler.CompileLoadElement(receiver_map);
(...skipping 24 matching lines...) Expand all
255 239
256 KeyedStoreStubCompiler compiler(isolate(), strict_mode, store_mode); 240 KeyedStoreStubCompiler compiler(isolate(), strict_mode, store_mode);
257 Handle<Code> code = compiler.CompileStoreElement(receiver_map); 241 Handle<Code> code = compiler.CompileStoreElement(receiver_map);
258 242
259 Map::UpdateCodeCache(receiver_map, name, code); 243 Map::UpdateCodeCache(receiver_map, name, code);
260 ASSERT(Code::GetKeyedAccessStoreMode(code->extra_ic_state()) == store_mode); 244 ASSERT(Code::GetKeyedAccessStoreMode(code->extra_ic_state()) == store_mode);
261 return code; 245 return code;
262 } 246 }
263 247
264 248
265 Handle<Code> StubCache::ComputeStoreGlobal(Handle<Name> name,
266 Handle<GlobalObject> receiver,
267 Handle<PropertyCell> cell,
268 Handle<Object> value,
269 StrictModeFlag strict_mode) {
270 Handle<Type> union_type = PropertyCell::UpdatedType(cell, value);
271 bool is_constant = union_type->IsConstant();
272 StoreGlobalStub stub(strict_mode, is_constant);
273
274 Handle<Code> code = FindIC(
275 name, Handle<JSObject>::cast(receiver),
276 Code::STORE_IC, stub.GetExtraICState());
277 if (!code.is_null()) return code;
278
279 // Replace the placeholder cell and global object map with the actual global
280 // cell and receiver map.
281 Handle<Map> meta_map(isolate_->heap()->meta_map());
282 Handle<Object> receiver_map(receiver->map(), isolate_);
283 code = stub.GetCodeCopyFromTemplate(isolate_);
284 code->ReplaceNthObject(1, *meta_map, *receiver_map);
285 Handle<Map> cell_map(isolate_->heap()->global_property_cell_map());
286 code->ReplaceNthObject(1, *cell_map, *cell);
287
288 HeapObject::UpdateMapCodeCache(receiver, name, code);
289
290 return code;
291 }
292
293
294 #define CALL_LOGGER_TAG(kind, type) \ 249 #define CALL_LOGGER_TAG(kind, type) \
295 (kind == Code::CALL_IC ? Logger::type : Logger::KEYED_##type) 250 (kind == Code::CALL_IC ? Logger::type : Logger::KEYED_##type)
296 251
297 Handle<Code> StubCache::ComputeCallConstant(int argc, 252 Handle<Code> StubCache::ComputeCallConstant(int argc,
298 Code::Kind kind, 253 Code::Kind kind,
299 Code::ExtraICState extra_state, 254 Code::ExtraICState extra_state,
300 Handle<Name> name, 255 Handle<Name> name,
301 Handle<Object> object, 256 Handle<Object> object,
302 Handle<JSObject> holder, 257 Handle<JSObject> holder,
303 Handle<JSFunction> function) { 258 Handle<JSFunction> function) {
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 #undef CALL_LOGGER_TAG 1089 #undef CALL_LOGGER_TAG
1135 1090
1136 1091
1137 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags, 1092 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags,
1138 const char* name) { 1093 const char* name) {
1139 // Create code object in the heap. 1094 // Create code object in the heap.
1140 CodeDesc desc; 1095 CodeDesc desc;
1141 masm_.GetCode(&desc); 1096 masm_.GetCode(&desc);
1142 Handle<Code> code = factory()->NewCode(desc, flags, masm_.CodeObject()); 1097 Handle<Code> code = factory()->NewCode(desc, flags, masm_.CodeObject());
1143 #ifdef ENABLE_DISASSEMBLER 1098 #ifdef ENABLE_DISASSEMBLER
1144 if (FLAG_print_code_stubs) code->Disassemble(name); 1099 if (FLAG_print_code_stubs) {
1100 CodeTracer::Scope trace_scope(isolate()->GetCodeTracer());
1101 code->Disassemble(name, trace_scope.file());
1102 }
1145 #endif 1103 #endif
1146 return code; 1104 return code;
1147 } 1105 }
1148 1106
1149 1107
1150 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags, 1108 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags,
1151 Handle<Name> name) { 1109 Handle<Name> name) {
1152 return (FLAG_print_code_stubs && !name.is_null() && name->IsString()) 1110 return (FLAG_print_code_stubs && !name.is_null() && name->IsString())
1153 ? GetCodeWithFlags(flags, *Handle<String>::cast(name)->ToCString()) 1111 ? GetCodeWithFlags(flags, *Handle<String>::cast(name)->ToCString())
1154 : GetCodeWithFlags(flags, NULL); 1112 : GetCodeWithFlags(flags, NULL);
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 Handle<Code> code = GetCodeWithFlags(flags, name); 1547 Handle<Code> code = GetCodeWithFlags(flags, name);
1590 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); 1548 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name));
1591 JitEvent(name, code); 1549 JitEvent(name, code);
1592 return code; 1550 return code;
1593 } 1551 }
1594 1552
1595 1553
1596 Handle<Code> BaseLoadStoreStubCompiler::GetCode(Code::Kind kind, 1554 Handle<Code> BaseLoadStoreStubCompiler::GetCode(Code::Kind kind,
1597 Code::StubType type, 1555 Code::StubType type,
1598 Handle<Name> name) { 1556 Handle<Name> name) {
1599 ASSERT(type != Code::NORMAL);
1600 Code::Flags flags = Code::ComputeFlags( 1557 Code::Flags flags = Code::ComputeFlags(
1601 Code::HANDLER, MONOMORPHIC, extra_state(), type, kind); 1558 Code::HANDLER, MONOMORPHIC, extra_state(), type, kind);
1602 Handle<Code> code = GetCodeWithFlags(flags, name); 1559 Handle<Code> code = GetCodeWithFlags(flags, name);
1603 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); 1560 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name));
1604 JitEvent(name, code); 1561 JitEvent(name, code);
1605 return code; 1562 return code;
1606 } 1563 }
1607 1564
1608 1565
1609 void KeyedLoadStubCompiler::CompileElementHandlers(MapHandleList* receiver_maps, 1566 void KeyedLoadStubCompiler::CompileElementHandlers(MapHandleList* receiver_maps,
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 Handle<FunctionTemplateInfo>( 1808 Handle<FunctionTemplateInfo>(
1852 FunctionTemplateInfo::cast(signature->receiver())); 1809 FunctionTemplateInfo::cast(signature->receiver()));
1853 } 1810 }
1854 } 1811 }
1855 1812
1856 is_simple_api_call_ = true; 1813 is_simple_api_call_ = true;
1857 } 1814 }
1858 1815
1859 1816
1860 } } // namespace v8::internal 1817 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698