| 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 static void FillCache(Isolate* isolate, Handle<Code> code) { | 408 static void FillCache(Isolate* isolate, Handle<Code> code) { |
| 409 Handle<UnseededNumberDictionary> dictionary = | 409 Handle<UnseededNumberDictionary> dictionary = |
| 410 UnseededNumberDictionary::Set(isolate->factory()->non_monomorphic_cache(), | 410 UnseededNumberDictionary::Set(isolate->factory()->non_monomorphic_cache(), |
| 411 code->flags(), | 411 code->flags(), |
| 412 code); | 412 code); |
| 413 isolate->heap()->public_set_non_monomorphic_cache(*dictionary); | 413 isolate->heap()->public_set_non_monomorphic_cache(*dictionary); |
| 414 } | 414 } |
| 415 | 415 |
| 416 | 416 |
| 417 Code* StubCache::FindCallInitialize(int argc, Code::Kind kind) { | 417 Code* StubCache::FindCallInitialize(int argc, Code::Kind kind) { |
| 418 ExtraICState extra_state = | 418 Code::Flags flags = Code::ComputeFlags( |
| 419 CallICBase::StringStubState::encode(DEFAULT_STRING_STUB); | 419 kind, UNINITIALIZED, kNoExtraICState, Code::NORMAL, argc); |
| 420 Code::Flags flags = | |
| 421 Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc); | |
| 422 UnseededNumberDictionary* dictionary = | 420 UnseededNumberDictionary* dictionary = |
| 423 isolate()->heap()->non_monomorphic_cache(); | 421 isolate()->heap()->non_monomorphic_cache(); |
| 424 int entry = dictionary->FindEntry(isolate(), flags); | 422 int entry = dictionary->FindEntry(isolate(), flags); |
| 425 ASSERT(entry != -1); | 423 ASSERT(entry != -1); |
| 426 Object* code = dictionary->ValueAt(entry); | 424 Object* code = dictionary->ValueAt(entry); |
| 427 // This might be called during the marking phase of the collector | 425 // This might be called during the marking phase of the collector |
| 428 // hence the unchecked cast. | 426 // hence the unchecked cast. |
| 429 return reinterpret_cast<Code*>(code); | 427 return reinterpret_cast<Code*>(code); |
| 430 } | 428 } |
| 431 | 429 |
| 432 | 430 |
| 433 Code* StubCache::FindPreMonomorphicIC(Code::Kind kind, ExtraICState state) { | 431 Code* StubCache::FindPreMonomorphicIC(Code::Kind kind, ExtraICState state) { |
| 434 Code::Flags flags = Code::ComputeFlags(kind, PREMONOMORPHIC, state); | 432 Code::Flags flags = Code::ComputeFlags(kind, PREMONOMORPHIC, state); |
| 435 UnseededNumberDictionary* dictionary = | 433 UnseededNumberDictionary* dictionary = |
| 436 isolate()->heap()->non_monomorphic_cache(); | 434 isolate()->heap()->non_monomorphic_cache(); |
| 437 int entry = dictionary->FindEntry(isolate(), flags); | 435 int entry = dictionary->FindEntry(isolate(), flags); |
| 438 ASSERT(entry != -1); | 436 ASSERT(entry != -1); |
| 439 Object* code = dictionary->ValueAt(entry); | 437 Object* code = dictionary->ValueAt(entry); |
| 440 // This might be called during the marking phase of the collector | 438 // This might be called during the marking phase of the collector |
| 441 // hence the unchecked cast. | 439 // hence the unchecked cast. |
| 442 return reinterpret_cast<Code*>(code); | 440 return reinterpret_cast<Code*>(code); |
| 443 } | 441 } |
| 444 | 442 |
| 445 | 443 |
| 446 Handle<Code> StubCache::ComputeCallInitialize(int argc, Code::Kind kind) { | 444 Handle<Code> StubCache::ComputeCallInitialize(int argc, Code::Kind kind) { |
| 447 ExtraICState extra_state = | 445 Code::Flags flags = Code::ComputeFlags( |
| 448 CallICBase::ComputeExtraICState(DEFAULT_STRING_STUB); | 446 kind, UNINITIALIZED, kNoExtraICState, Code::NORMAL, argc); |
| 449 Code::Flags flags = | |
| 450 Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc); | |
| 451 Handle<UnseededNumberDictionary> cache = | 447 Handle<UnseededNumberDictionary> cache = |
| 452 isolate_->factory()->non_monomorphic_cache(); | 448 isolate_->factory()->non_monomorphic_cache(); |
| 453 int entry = cache->FindEntry(isolate_, flags); | 449 int entry = cache->FindEntry(isolate_, flags); |
| 454 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); | 450 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); |
| 455 | 451 |
| 456 StubCompiler compiler(isolate_); | 452 StubCompiler compiler(isolate_); |
| 457 Handle<Code> code = compiler.CompileCallInitialize(flags); | 453 Handle<Code> code = compiler.CompileCallInitialize(flags); |
| 458 FillCache(isolate_, code); | 454 FillCache(isolate_, code); |
| 459 return code; | 455 return code; |
| 460 } | 456 } |
| (...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2013 Handle<FunctionTemplateInfo>( | 2009 Handle<FunctionTemplateInfo>( |
| 2014 FunctionTemplateInfo::cast(signature->receiver())); | 2010 FunctionTemplateInfo::cast(signature->receiver())); |
| 2015 } | 2011 } |
| 2016 } | 2012 } |
| 2017 | 2013 |
| 2018 is_simple_api_call_ = true; | 2014 is_simple_api_call_ = true; |
| 2019 } | 2015 } |
| 2020 | 2016 |
| 2021 | 2017 |
| 2022 } } // namespace v8::internal | 2018 } } // namespace v8::internal |
| OLD | NEW |