| OLD | NEW |
| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 kind, extra_state, cache_holder); | 109 kind, extra_state, cache_holder); |
| 110 Handle<Object> probe(stub_holder->FindInCodeCache(*name, flags), isolate_); | 110 Handle<Object> probe(stub_holder->FindInCodeCache(*name, flags), isolate_); |
| 111 if (probe->IsCode()) return Handle<Code>::cast(probe); | 111 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 112 return Handle<Code>::null(); | 112 return Handle<Code>::null(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 | 115 |
| 116 Handle<Code> StubCache::FindHandler(Handle<Name> name, | 116 Handle<Code> StubCache::FindHandler(Handle<Name> name, |
| 117 Handle<Map> stub_holder, | 117 Handle<Map> stub_holder, |
| 118 Code::Kind kind, | 118 Code::Kind kind, |
| 119 InlineCacheHolderFlag cache_holder) { | 119 InlineCacheHolderFlag cache_holder, |
| 120 Code::Flags flags = Code::ComputeMonomorphicFlags( | 120 Code::StubType type) { |
| 121 Code::HANDLER, kNoExtraICState, cache_holder, Code::NORMAL); | 121 Code::Flags flags = Code::ComputeHandlerFlags(kind, type, cache_holder); |
| 122 | 122 |
| 123 Handle<Object> probe(stub_holder->FindInCodeCache(*name, flags), isolate_); | 123 Handle<Object> probe(stub_holder->FindInCodeCache(*name, flags), isolate_); |
| 124 if (probe->IsCode()) return Handle<Code>::cast(probe); | 124 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 125 return Handle<Code>::null(); | 125 return Handle<Code>::null(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 | 128 |
| 129 Handle<Code> StubCache::ComputeMonomorphicIC( | 129 Handle<Code> StubCache::ComputeMonomorphicIC( |
| 130 Code::Kind kind, | 130 Code::Kind kind, |
| 131 Handle<Name> name, | 131 Handle<Name> name, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 while (!next->IsNull()) { | 185 while (!next->IsNull()) { |
| 186 last = Handle<JSObject>::cast(next); | 186 last = Handle<JSObject>::cast(next); |
| 187 next = handle(current_map->prototype(), isolate()); | 187 next = handle(current_map->prototype(), isolate()); |
| 188 current_map = handle(Handle<HeapObject>::cast(next)->map()); | 188 current_map = handle(Handle<HeapObject>::cast(next)->map()); |
| 189 if (current_map->is_dictionary_map()) cache_name = name; | 189 if (current_map->is_dictionary_map()) cache_name = name; |
| 190 } | 190 } |
| 191 | 191 |
| 192 // Compile the stub that is either shared for all names or | 192 // Compile the stub that is either shared for all names or |
| 193 // name specific if there are global objects involved. | 193 // name specific if there are global objects involved. |
| 194 Handle<Code> handler = FindHandler( | 194 Handle<Code> handler = FindHandler( |
| 195 cache_name, stub_holder, Code::LOAD_IC, flag); | 195 cache_name, stub_holder, Code::LOAD_IC, flag, Code::FAST); |
| 196 if (!handler.is_null()) return handler; | 196 if (!handler.is_null()) { |
| 197 #ifdef DEBUG |
| 198 LoadStubCompiler compiler(isolate_, kNoExtraICState, flag); |
| 199 Handle<Code> compiled = compiler.CompileLoadNonexistent( |
| 200 type, last, cache_name); |
| 201 ASSERT(compiled->major_key() == handler->major_key()); |
| 202 ASSERT(compiled->flags() == handler->flags()); |
| 203 #endif |
| 204 return handler; |
| 205 } |
| 197 | 206 |
| 198 LoadStubCompiler compiler(isolate_, kNoExtraICState, flag); | 207 LoadStubCompiler compiler(isolate_, kNoExtraICState, flag); |
| 199 handler = compiler.CompileLoadNonexistent(type, last, cache_name); | 208 handler = compiler.CompileLoadNonexistent(type, last, cache_name); |
| 200 Map::UpdateCodeCache(stub_holder, cache_name, handler); | 209 Map::UpdateCodeCache(stub_holder, cache_name, handler); |
| 201 return handler; | 210 return handler; |
| 202 } | 211 } |
| 203 | 212 |
| 204 | 213 |
| 205 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) { | 214 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) { |
| 206 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC); | 215 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC); |
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1460 Handle<FunctionTemplateInfo>( | 1469 Handle<FunctionTemplateInfo>( |
| 1461 FunctionTemplateInfo::cast(signature->receiver())); | 1470 FunctionTemplateInfo::cast(signature->receiver())); |
| 1462 } | 1471 } |
| 1463 } | 1472 } |
| 1464 | 1473 |
| 1465 is_simple_api_call_ = true; | 1474 is_simple_api_call_ = true; |
| 1466 } | 1475 } |
| 1467 | 1476 |
| 1468 | 1477 |
| 1469 } } // namespace v8::internal | 1478 } } // namespace v8::internal |
| OLD | NEW |