~ubuntu-branches/ubuntu/saucy/libv8/saucy

« back to all changes in this revision

Viewing changes to src/stub-cache.cc

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2012-04-07 16:26:13 UTC
  • mfrom: (15.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20120407162613-dqo1m6w9r3fh8tst
Tags: 3.8.9.16-3
* mipsel build fixes :
  + v8_use_mips_abi_hardfloat=false, this lowers EABI requirements.
  + v8_can_use_fpu_instructions=false, detect if FPU is present.
  + set -Wno-unused-but-set-variable only on mipsel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
184
184
Handle<Code> StubCache::ComputeLoadConstant(Handle<String> name,
185
185
                                            Handle<JSObject> receiver,
186
186
                                            Handle<JSObject> holder,
187
 
                                            Handle<Object> value) {
 
187
                                            Handle<JSFunction> value) {
188
188
  ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
189
189
  Code::Flags flags =
190
190
      Code::ComputeMonomorphicFlags(Code::LOAD_IC, CONSTANT_FUNCTION);
266
266
Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<String> name,
267
267
                                                 Handle<JSObject> receiver,
268
268
                                                 Handle<JSObject> holder,
269
 
                                                 Handle<Object> value) {
 
269
                                                 Handle<JSFunction> value) {
270
270
  ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
271
271
  Code::Flags flags =
272
272
      Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CONSTANT_FUNCTION);
678
678
 
679
679
 
680
680
static void FillCache(Isolate* isolate, Handle<Code> code) {
681
 
  Handle<NumberDictionary> dictionary =
682
 
      NumberDictionarySet(isolate->factory()->non_monomorphic_cache(),
683
 
                          code->flags(),
684
 
                          code,
685
 
                          PropertyDetails(NONE, NORMAL));
 
681
  Handle<UnseededNumberDictionary> dictionary =
 
682
      UnseededNumberDictionary::Set(isolate->factory()->non_monomorphic_cache(),
 
683
                                    code->flags(),
 
684
                                    code);
686
685
  isolate->heap()->public_set_non_monomorphic_cache(*dictionary);
687
686
}
688
687
 
697
696
      Code::ComputeFlags(kind, UNINITIALIZED, extra_state, NORMAL, argc);
698
697
 
699
698
  // Use raw_unchecked... so we don't get assert failures during GC.
700
 
  NumberDictionary* dictionary =
 
699
  UnseededNumberDictionary* dictionary =
701
700
      isolate()->heap()->raw_unchecked_non_monomorphic_cache();
702
701
  int entry = dictionary->FindEntry(isolate(), flags);
703
702
  ASSERT(entry != -1);
716
715
      CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT);
717
716
  Code::Flags flags =
718
717
      Code::ComputeFlags(kind, UNINITIALIZED, extra_state, NORMAL, argc);
719
 
  Handle<NumberDictionary> cache = isolate_->factory()->non_monomorphic_cache();
 
718
  Handle<UnseededNumberDictionary> cache =
 
719
      isolate_->factory()->non_monomorphic_cache();
720
720
  int entry = cache->FindEntry(isolate_, flags);
721
721
  if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
722
722
 
744
744
    Code::ExtraICState extra_state) {
745
745
  Code::Flags flags =
746
746
      Code::ComputeFlags(kind, PREMONOMORPHIC, extra_state, NORMAL, argc);
747
 
  Handle<NumberDictionary> cache = isolate_->factory()->non_monomorphic_cache();
 
747
  Handle<UnseededNumberDictionary> cache =
 
748
      isolate_->factory()->non_monomorphic_cache();
748
749
  int entry = cache->FindEntry(isolate_, flags);
749
750
  if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
750
751
 
760
761
                                          Code::ExtraICState extra_state) {
761
762
  Code::Flags flags =
762
763
      Code::ComputeFlags(kind, MONOMORPHIC, extra_state, NORMAL, argc);
763
 
  Handle<NumberDictionary> cache = isolate_->factory()->non_monomorphic_cache();
 
764
  Handle<UnseededNumberDictionary> cache =
 
765
      isolate_->factory()->non_monomorphic_cache();
764
766
  int entry = cache->FindEntry(isolate_, flags);
765
767
  if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
766
768
 
776
778
  Code::Flags flags =
777
779
      Code::ComputeFlags(kind, MEGAMORPHIC, Code::kNoExtraICState,
778
780
                         NORMAL, argc);
779
 
  Handle<NumberDictionary> cache = isolate_->factory()->non_monomorphic_cache();
 
781
  Handle<UnseededNumberDictionary> cache =
 
782
      isolate_->factory()->non_monomorphic_cache();
780
783
  int entry = cache->FindEntry(isolate_, flags);
781
784
  if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
782
785
 
794
797
  Code::Flags flags =
795
798
      Code::ComputeFlags(kind, MEGAMORPHIC, extra_state,
796
799
                         NORMAL, argc);
797
 
  Handle<NumberDictionary> cache = isolate_->factory()->non_monomorphic_cache();
 
800
  Handle<UnseededNumberDictionary> cache =
 
801
      isolate_->factory()->non_monomorphic_cache();
798
802
  int entry = cache->FindEntry(isolate_, flags);
799
803
  if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
800
804
 
813
817
  Code::Flags flags =
814
818
      Code::ComputeFlags(kind, MONOMORPHIC_PROTOTYPE_FAILURE, extra_state,
815
819
                         NORMAL, argc, OWN_MAP);
816
 
  Handle<NumberDictionary> cache = isolate_->factory()->non_monomorphic_cache();
 
820
  Handle<UnseededNumberDictionary> cache =
 
821
      isolate_->factory()->non_monomorphic_cache();
817
822
  int entry = cache->FindEntry(isolate_, flags);
818
823
  if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
819
824
 
832
837
  Code::Flags flags =
833
838
      Code::ComputeFlags(kind, DEBUG_BREAK, Code::kNoExtraICState,
834
839
                         NORMAL, argc);
835
 
  Handle<NumberDictionary> cache = isolate_->factory()->non_monomorphic_cache();
 
840
  Handle<UnseededNumberDictionary> cache =
 
841
      isolate_->factory()->non_monomorphic_cache();
836
842
  int entry = cache->FindEntry(isolate_, flags);
837
843
  if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
838
844
 
850
856
  Code::Flags flags =
851
857
      Code::ComputeFlags(kind, DEBUG_PREPARE_STEP_IN, Code::kNoExtraICState,
852
858
                         NORMAL, argc);
853
 
  Handle<NumberDictionary> cache = isolate_->factory()->non_monomorphic_cache();
 
859
  Handle<UnseededNumberDictionary> cache =
 
860
      isolate_->factory()->non_monomorphic_cache();
854
861
  int entry = cache->FindEntry(isolate_, flags);
855
862
  if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
856
863
 
1445
1452
 
1446
1453
 
1447
1454
CallOptimization::CallOptimization(LookupResult* lookup) {
1448
 
  if (!lookup->IsProperty() ||
1449
 
      !lookup->IsCacheable() ||
1450
 
      lookup->type() != CONSTANT_FUNCTION) {
1451
 
    Initialize(Handle<JSFunction>::null());
1452
 
  } else {
 
1455
  if (lookup->IsFound() &&
 
1456
      lookup->IsCacheable() &&
 
1457
      lookup->type() == CONSTANT_FUNCTION) {
1453
1458
    // We only optimize constant function calls.
1454
1459
    Initialize(Handle<JSFunction>(lookup->GetConstantFunction()));
 
1460
  } else {
 
1461
    Initialize(Handle<JSFunction>::null());
1455
1462
  }
1456
1463
}
1457
1464