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

« back to all changes in this revision

Viewing changes to src/ia32/stub-cache-ia32.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:
1
 
// Copyright 2011 the V8 project authors. All rights reserved.
 
1
// Copyright 2012 the V8 project authors. All rights reserved.
2
2
// Redistribution and use in source and binary forms, with or without
3
3
// modification, are permitted provided that the following conditions are
4
4
// met:
429
429
  // -----------------------------------
430
430
  // Get the function and setup the context.
431
431
  Handle<JSFunction> function = optimization.constant_function();
432
 
  __ mov(edi, Immediate(function));
 
432
  __ LoadHeapObject(edi, function);
433
433
  __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
434
434
 
435
435
  // Pass the additional arguments.
695
695
                                      Register name_reg,
696
696
                                      Register scratch,
697
697
                                      Label* miss_label) {
698
 
  // Check that the object isn't a smi.
699
 
  __ JumpIfSmi(receiver_reg, miss_label);
700
 
 
701
698
  // Check that the map of the object hasn't changed.
702
 
  __ cmp(FieldOperand(receiver_reg, HeapObject::kMapOffset),
703
 
         Immediate(Handle<Map>(object->map())));
704
 
  __ j(not_equal, miss_label);
 
699
  __ CheckMap(receiver_reg, Handle<Map>(object->map()),
 
700
              miss_label, DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS);
705
701
 
706
702
  // Perform global security token check if needed.
707
703
  if (object->IsJSGlobalProxy()) {
878
874
      if (in_new_space) {
879
875
        // Save the map in scratch1 for later.
880
876
        __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
881
 
        __ cmp(scratch1, Immediate(current_map));
882
 
      } else {
883
 
        __ cmp(FieldOperand(reg, HeapObject::kMapOffset),
884
 
               Immediate(current_map));
885
877
      }
886
 
      // Branch on the result of the map check.
887
 
      __ j(not_equal, miss);
 
878
      __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK,
 
879
                  ALLOW_ELEMENT_TRANSITION_MAPS);
 
880
 
888
881
      // Check access rights to the global object.  This has to happen after
889
882
      // the map check so that we know that the object is actually a global
890
883
      // object.
916
909
  LOG(isolate(), IntEvent("check-maps-depth", depth + 1));
917
910
 
918
911
  // Check the holder map.
919
 
  __ cmp(FieldOperand(reg, HeapObject::kMapOffset),
920
 
         Immediate(Handle<Map>(holder->map())));
921
 
  __ j(not_equal, miss);
 
912
  __ CheckMap(reg, Handle<Map>(holder->map()),
 
913
              miss, DONT_DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS);
922
914
 
923
915
  // Perform security check for access to the global object.
924
916
  ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded());
1000
992
 
1001
993
  __ push(scratch3);  // Restore return address.
1002
994
 
1003
 
  // 3 elements array for v8::Agruments::values_, handler for name and pointer
 
995
  // 3 elements array for v8::Arguments::values_, handler for name and pointer
1004
996
  // to the values (it considered as smi in GC).
1005
997
  const int kStackSpace = 5;
1006
998
  const int kApiArgc = 2;
1025
1017
                                        Register scratch1,
1026
1018
                                        Register scratch2,
1027
1019
                                        Register scratch3,
1028
 
                                        Handle<Object> value,
 
1020
                                        Handle<JSFunction> value,
1029
1021
                                        Handle<String> name,
1030
1022
                                        Label* miss) {
1031
1023
  // Check that the receiver isn't a smi.
1036
1028
      object, receiver, holder, scratch1, scratch2, scratch3, name, miss);
1037
1029
 
1038
1030
  // Return the constant value.
1039
 
  __ mov(eax, value);
 
1031
  __ LoadHeapObject(eax, value);
1040
1032
  __ ret(0);
1041
1033
}
1042
1034
 
1061
1053
  // and CALLBACKS, so inline only them, other cases may be added
1062
1054
  // later.
1063
1055
  bool compile_followup_inline = false;
1064
 
  if (lookup->IsProperty() && lookup->IsCacheable()) {
 
1056
  if (lookup->IsFound() && lookup->IsCacheable()) {
1065
1057
    if (lookup->type() == FIELD) {
1066
1058
      compile_followup_inline = true;
1067
1059
    } else if (lookup->type() == CALLBACKS &&
1203
1195
  // Get the receiver from the stack.
1204
1196
  __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
1205
1197
 
1206
 
  // If the object is the holder then we know that it's a global
1207
 
  // object which can only happen for contextual calls. In this case,
1208
 
  // the receiver cannot be a smi.
1209
 
  if (!object.is_identical_to(holder)) {
1210
 
    __ JumpIfSmi(edx, miss);
1211
 
  }
1212
1198
 
1213
1199
  // Check that the maps haven't changed.
 
1200
  __ JumpIfSmi(edx, miss);
1214
1201
  CheckPrototypes(object, edx, holder, ebx, eax, edi, name, miss);
1215
1202
}
1216
1203
 
2338
2325
    __ mov(Operand(esp, (argc + 1) * kPointerSize), edx);
2339
2326
  }
2340
2327
 
2341
 
  // Setup the context (function already in edi).
 
2328
  // Set up the context (function already in edi).
2342
2329
  __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
2343
2330
 
2344
2331
  // Jump to the cached code (tail call).
2403
2390
  // -----------------------------------
2404
2391
  Label miss;
2405
2392
 
2406
 
  // Check that the object isn't a smi.
2407
 
  __ JumpIfSmi(edx, &miss);
2408
 
 
2409
2393
  // Check that the map of the object hasn't changed.
2410
 
  __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
2411
 
         Immediate(Handle<Map>(object->map())));
2412
 
  __ j(not_equal, &miss);
 
2394
  __ CheckMap(edx, Handle<Map>(object->map()),
 
2395
              &miss, DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS);
2413
2396
 
2414
2397
  // Perform global security token check if needed.
2415
2398
  if (object->IsJSGlobalProxy()) {
2453
2436
  // -----------------------------------
2454
2437
  Label miss;
2455
2438
 
2456
 
  // Check that the object isn't a smi.
2457
 
  __ JumpIfSmi(edx, &miss);
2458
 
 
2459
2439
  // Check that the map of the object hasn't changed.
2460
 
  __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
2461
 
         Immediate(Handle<Map>(receiver->map())));
2462
 
  __ j(not_equal, &miss);
 
2440
  __ CheckMap(edx, Handle<Map>(receiver->map()),
 
2441
              &miss, DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS);
2463
2442
 
2464
2443
  // Perform global security token check if needed.
2465
2444
  if (receiver->IsJSGlobalProxy()) {
2715
2694
 
2716
2695
Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object,
2717
2696
                                                   Handle<JSObject> holder,
2718
 
                                                   Handle<Object> value,
 
2697
                                                   Handle<JSFunction> value,
2719
2698
                                                   Handle<String> name) {
2720
2699
  // ----------- S t a t e -------------
2721
2700
  //  -- eax    : receiver
2772
2751
  // -----------------------------------
2773
2752
  Label miss;
2774
2753
 
2775
 
  // If the object is the holder then we know that it's a global
2776
 
  // object which can only happen for contextual loads. In this case,
2777
 
  // the receiver cannot be a smi.
2778
 
  if (!object.is_identical_to(holder)) {
2779
 
    __ JumpIfSmi(eax, &miss);
2780
 
  }
2781
 
 
2782
2754
  // Check that the maps haven't changed.
 
2755
  __ JumpIfSmi(eax, &miss);
2783
2756
  CheckPrototypes(object, eax, holder, ebx, edx, edi, name, &miss);
2784
2757
 
2785
2758
  // Get the value from the cell.
2877
2850
    Handle<String> name,
2878
2851
    Handle<JSObject> receiver,
2879
2852
    Handle<JSObject> holder,
2880
 
    Handle<Object> value) {
 
2853
    Handle<JSFunction> value) {
2881
2854
  // ----------- S t a t e -------------
2882
2855
  //  -- eax    : key
2883
2856
  //  -- edx    : receiver