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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 Code::Flags flags = Code::ComputeMonomorphicFlags( | 120 Code::Flags flags = Code::ComputeMonomorphicFlags( |
121 Code::HANDLER, kNoExtraICState, cache_holder, Code::NORMAL, kind); | 121 Code::HANDLER, kNoExtraICState, cache_holder, Code::NORMAL, kind); |
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 Handle<Name> name, | 131 Handle<Name> name, |
131 Handle<HeapType> type, | 132 Handle<HeapType> type, |
132 Handle<Code> handler, | 133 Handle<Code> handler, |
133 ExtraICState extra_ic_state) { | 134 ExtraICState extra_ic_state) { |
134 Code::Kind kind = handler->handler_kind(); | |
135 InlineCacheHolderFlag flag = IC::GetCodeCacheFlag(*type); | 135 InlineCacheHolderFlag flag = IC::GetCodeCacheFlag(*type); |
136 | 136 |
137 Handle<Map> stub_holder; | 137 Handle<Map> stub_holder; |
138 Handle<Code> ic; | 138 Handle<Code> ic; |
139 // There are multiple string maps that all use the same prototype. That | 139 // There are multiple string maps that all use the same prototype. That |
140 // prototype cannot hold multiple handlers, one for each of the string maps, | 140 // prototype cannot hold multiple handlers, one for each of the string maps, |
141 // for a single name. Hence, turn off caching of the IC. | 141 // for a single name. Hence, turn off caching of the IC. |
142 bool can_be_cached = !type->Is(HeapType::String()); | 142 bool can_be_cached = !type->Is(HeapType::String()); |
143 if (can_be_cached) { | 143 if (can_be_cached) { |
144 stub_holder = IC::GetCodeCacheHolder(flag, *type, isolate()); | 144 stub_holder = IC::GetCodeCacheHolder(flag, *type, isolate()); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 &types, &handlers, factory()->empty_string(), Code::NORMAL, ELEMENT); | 362 &types, &handlers, factory()->empty_string(), Code::NORMAL, ELEMENT); |
363 | 363 |
364 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment(); | 364 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment(); |
365 | 365 |
366 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); | 366 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); |
367 return code; | 367 return code; |
368 } | 368 } |
369 | 369 |
370 | 370 |
371 Handle<Code> StubCache::ComputePolymorphicIC( | 371 Handle<Code> StubCache::ComputePolymorphicIC( |
| 372 Code::Kind kind, |
372 TypeHandleList* types, | 373 TypeHandleList* types, |
373 CodeHandleList* handlers, | 374 CodeHandleList* handlers, |
374 int number_of_valid_types, | 375 int number_of_valid_types, |
375 Handle<Name> name, | 376 Handle<Name> name, |
376 ExtraICState extra_ic_state) { | 377 ExtraICState extra_ic_state) { |
377 | |
378 Handle<Code> handler = handlers->at(0); | 378 Handle<Code> handler = handlers->at(0); |
379 Code::Kind kind = handler->handler_kind(); | |
380 Code::StubType type = number_of_valid_types == 1 ? handler->type() | 379 Code::StubType type = number_of_valid_types == 1 ? handler->type() |
381 : Code::NORMAL; | 380 : Code::NORMAL; |
382 if (kind == Code::LOAD_IC) { | 381 if (kind == Code::LOAD_IC) { |
383 LoadStubCompiler ic_compiler(isolate_, extra_ic_state); | 382 LoadStubCompiler ic_compiler(isolate_, extra_ic_state); |
384 return ic_compiler.CompilePolymorphicIC( | 383 return ic_compiler.CompilePolymorphicIC( |
385 types, handlers, name, type, PROPERTY); | 384 types, handlers, name, type, PROPERTY); |
386 } else { | 385 } else { |
387 ASSERT(kind == Code::STORE_IC); | 386 ASSERT(kind == Code::STORE_IC); |
388 StoreStubCompiler ic_compiler(isolate_, extra_ic_state); | 387 StoreStubCompiler ic_compiler(isolate_, extra_ic_state); |
389 return ic_compiler.CompilePolymorphicIC( | 388 return ic_compiler.CompilePolymorphicIC( |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 Handle<FunctionTemplateInfo>( | 1445 Handle<FunctionTemplateInfo>( |
1447 FunctionTemplateInfo::cast(signature->receiver())); | 1446 FunctionTemplateInfo::cast(signature->receiver())); |
1448 } | 1447 } |
1449 } | 1448 } |
1450 | 1449 |
1451 is_simple_api_call_ = true; | 1450 is_simple_api_call_ = true; |
1452 } | 1451 } |
1453 | 1452 |
1454 | 1453 |
1455 } } // namespace v8::internal | 1454 } } // namespace v8::internal |
OLD | NEW |