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

« back to all changes in this revision

Viewing changes to src/mips/stub-cache-mips.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:
377
377
                                      Label* miss_label) {
378
378
  // a0 : value.
379
379
  Label exit;
380
 
 
381
 
  // Check that the receiver isn't a smi.
382
 
  __ JumpIfSmi(receiver_reg, miss_label, scratch);
383
 
 
384
 
  // Check that the map of the receiver hasn't changed.
385
 
  __ lw(scratch, FieldMemOperand(receiver_reg, HeapObject::kMapOffset));
386
 
  __ Branch(miss_label, ne, scratch, Operand(Handle<Map>(object->map())));
 
380
  // Check that the map of the object hasn't changed.
 
381
  __ CheckMap(receiver_reg, scratch, Handle<Map>(object->map()), miss_label,
 
382
              DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS);
387
383
 
388
384
  // Perform global security token check if needed.
389
385
  if (object->IsJSGlobalProxy()) {
565
561
                                      int argc) {
566
562
  // ----------- S t a t e -------------
567
563
  //  -- sp[0]              : holder (set by CheckPrototypes)
568
 
  //  -- sp[4]              : callee js function
 
564
  //  -- sp[4]              : callee JS function
569
565
  //  -- sp[8]              : call data
570
 
  //  -- sp[12]             : last js argument
 
566
  //  -- sp[12]             : last JS argument
571
567
  //  -- ...
572
 
  //  -- sp[(argc + 3) * 4] : first js argument
 
568
  //  -- sp[(argc + 3) * 4] : first JS argument
573
569
  //  -- sp[(argc + 4) * 4] : receiver
574
570
  // -----------------------------------
575
571
  // Get the function and setup the context.
576
572
  Handle<JSFunction> function = optimization.constant_function();
577
 
  __ li(t1, Operand(function));
 
573
  __ LoadHeapObject(t1, function);
578
574
  __ lw(cp, FieldMemOperand(t1, JSFunction::kContextOffset));
579
575
 
580
576
  // Pass the additional arguments FastHandleApiCall expects.
587
583
    __ li(t2, call_data);
588
584
  }
589
585
 
590
 
  // Store js function and call data.
 
586
  // Store JS function and call data.
591
587
  __ sw(t1, MemOperand(sp, 1 * kPointerSize));
592
588
  __ sw(t2, MemOperand(sp, 2 * kPointerSize));
593
589
 
747
743
          ? CALL_AS_FUNCTION
748
744
          : CALL_AS_METHOD;
749
745
      __ InvokeFunction(optimization.constant_function(), arguments_,
750
 
                        JUMP_FUNCTION, call_kind);
 
746
                        JUMP_FUNCTION, NullCallWrapper(), call_kind);
751
747
    }
752
748
 
753
749
    // Deferred code for fast API call case---clean preallocated space.
1037
1033
      __ lw(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset));
1038
1034
    } else {
1039
1035
      Handle<Map> current_map(current->map());
1040
 
      __ lw(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
1041
 
      // Branch on the result of the map check.
1042
 
      __ Branch(miss, ne, scratch1, Operand(current_map));
 
1036
      __ CheckMap(reg, scratch1, current_map, miss, DONT_DO_SMI_CHECK,
 
1037
                  ALLOW_ELEMENT_TRANSITION_MAPS);
1043
1038
      // Check access rights to the global object.  This has to happen after
1044
1039
      // the map check so that we know that the object is actually a global
1045
1040
      // object.
1070
1065
  LOG(masm()->isolate(), IntEvent("check-maps-depth", depth + 1));
1071
1066
 
1072
1067
  // Check the holder map.
1073
 
  __ lw(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
1074
 
  __ Branch(miss, ne, scratch1, Operand(Handle<Map>(current->map())));
 
1068
  __ CheckMap(reg, scratch1, Handle<Map>(current->map()), miss,
 
1069
              DONT_DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS);
1075
1070
 
1076
1071
  // Perform security check for access to the global object.
1077
1072
  ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded());
1115
1110
                                        Register scratch1,
1116
1111
                                        Register scratch2,
1117
1112
                                        Register scratch3,
1118
 
                                        Handle<Object> value,
 
1113
                                        Handle<JSFunction> value,
1119
1114
                                        Handle<String> name,
1120
1115
                                        Label* miss) {
1121
1116
  // Check that the receiver isn't a smi.
1127
1122
                      scratch1, scratch2, scratch3, name, miss);
1128
1123
 
1129
1124
  // Return the constant value.
1130
 
  __ li(v0, Operand(value));
 
1125
  __ LoadHeapObject(v0, value);
1131
1126
  __ Ret();
1132
1127
}
1133
1128
 
1173
1168
  __ EnterExitFrame(false, kApiStackSpace);
1174
1169
 
1175
1170
  // Create AccessorInfo instance on the stack above the exit frame with
1176
 
  // scratch2 (internal::Object **args_) as the data.
 
1171
  // scratch2 (internal::Object** args_) as the data.
1177
1172
  __ sw(a2, MemOperand(sp, kPointerSize));
1178
1173
  // a2 (second argument - see note above) = AccessorInfo&
1179
1174
  __ Addu(a2, sp, kPointerSize);
1209
1204
  // and CALLBACKS, so inline only them, other cases may be added
1210
1205
  // later.
1211
1206
  bool compile_followup_inline = false;
1212
 
  if (lookup->IsProperty() && lookup->IsCacheable()) {
 
1207
  if (lookup->IsFound() && lookup->IsCacheable()) {
1213
1208
    if (lookup->type() == FIELD) {
1214
1209
      compile_followup_inline = true;
1215
1210
    } else if (lookup->type() == CALLBACKS &&
1348
1343
  // Get the receiver from the stack.
1349
1344
  __ lw(a0, MemOperand(sp, argc * kPointerSize));
1350
1345
 
1351
 
  // If the object is the holder then we know that it's a global
1352
 
  // object which can only happen for contextual calls. In this case,
1353
 
  // the receiver cannot be a smi.
1354
 
  if (!object.is_identical_to(holder)) {
1355
 
    __ JumpIfSmi(a0, miss);
1356
 
  }
1357
 
 
1358
1346
  // Check that the maps haven't changed.
 
1347
  __ JumpIfSmi(a0, miss);
1359
1348
  CheckPrototypes(object, a0, holder, a3, a1, t0, name, miss);
1360
1349
}
1361
1350
 
1934
1923
  // Tail call the full function. We do not have to patch the receiver
1935
1924
  // because the function makes no use of it.
1936
1925
  __ bind(&slow);
1937
 
  __ InvokeFunction(function, arguments(), JUMP_FUNCTION, CALL_AS_METHOD);
 
1926
  __ InvokeFunction(
 
1927
      function, arguments(), JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
1938
1928
 
1939
1929
  __ bind(&miss);
1940
1930
  // a2: function name.
2067
2057
  __ bind(&slow);
2068
2058
  // Tail call the full function. We do not have to patch the receiver
2069
2059
  // because the function makes no use of it.
2070
 
  __ InvokeFunction(function, arguments(), JUMP_FUNCTION, CALL_AS_METHOD);
 
2060
  __ InvokeFunction(
 
2061
      function, arguments(), JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2071
2062
 
2072
2063
  __ bind(&miss);
2073
2064
  // a2: function name.
2167
2158
  // Tail call the full function. We do not have to patch the receiver
2168
2159
  // because the function makes no use of it.
2169
2160
  __ bind(&slow);
2170
 
  __ InvokeFunction(function, arguments(), JUMP_FUNCTION, CALL_AS_METHOD);
 
2161
  __ InvokeFunction(
 
2162
      function, arguments(), JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
2171
2163
 
2172
2164
  __ bind(&miss);
2173
2165
  // a2: function name.
2346
2338
  CallKind call_kind = CallICBase::Contextual::decode(extra_state_)
2347
2339
      ? CALL_AS_FUNCTION
2348
2340
      : CALL_AS_METHOD;
2349
 
  __ InvokeFunction(function, arguments(), JUMP_FUNCTION, call_kind);
 
2341
  __ InvokeFunction(
 
2342
      function, arguments(), JUMP_FUNCTION, NullCallWrapper(), call_kind);
2350
2343
 
2351
2344
  // Handle call cache miss.
2352
2345
  __ bind(&miss);
2430
2423
    __ sw(a3, MemOperand(sp, argc * kPointerSize));
2431
2424
  }
2432
2425
 
2433
 
  // Setup the context (function already in r1).
 
2426
  // Set up the context (function already in r1).
2434
2427
  __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
2435
2428
 
2436
2429
  // Jump to the cached code (tail call).
2493
2486
  // -----------------------------------
2494
2487
  Label miss;
2495
2488
 
2496
 
  // Check that the object isn't a smi.
2497
 
  __ JumpIfSmi(a1, &miss);
2498
 
 
2499
2489
  // Check that the map of the object hasn't changed.
2500
 
  __ lw(a3, FieldMemOperand(a1, HeapObject::kMapOffset));
2501
 
  __ Branch(&miss, ne, a3, Operand(Handle<Map>(object->map())));
 
2490
  __ CheckMap(a1, a3, Handle<Map>(object->map()), &miss,
 
2491
              DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS);
2502
2492
 
2503
2493
  // Perform global security token check if needed.
2504
2494
  if (object->IsJSGlobalProxy()) {
2540
2530
  // -----------------------------------
2541
2531
  Label miss;
2542
2532
 
2543
 
  // Check that the object isn't a smi.
2544
 
  __ JumpIfSmi(a1, &miss);
2545
 
 
2546
2533
  // Check that the map of the object hasn't changed.
2547
 
  __ lw(a3, FieldMemOperand(a1, HeapObject::kMapOffset));
2548
 
  __ Branch(&miss, ne, a3, Operand(Handle<Map>(receiver->map())));
 
2534
  __ CheckMap(a1, a3, Handle<Map>(receiver->map()), &miss,
 
2535
              DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS);
2549
2536
 
2550
2537
  // Perform global security token check if needed.
2551
2538
  if (receiver->IsJSGlobalProxy()) {
2701
2688
 
2702
2689
Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object,
2703
2690
                                                   Handle<JSObject> holder,
2704
 
                                                   Handle<Object> value,
 
2691
                                                   Handle<JSFunction> value,
2705
2692
                                                   Handle<String> name) {
2706
2693
  // ----------- S t a t e -------------
2707
2694
  //  -- a0    : receiver
2755
2742
  // -----------------------------------
2756
2743
  Label miss;
2757
2744
 
2758
 
  // If the object is the holder then we know that it's a global
2759
 
  // object which can only happen for contextual calls. In this case,
2760
 
  // the receiver cannot be a smi.
2761
 
  if (!object.is_identical_to(holder)) {
2762
 
    __ JumpIfSmi(a0, &miss);
2763
 
  }
2764
 
 
2765
2745
  // Check that the map of the global has not changed.
 
2746
  __ JumpIfSmi(a0, &miss);
2766
2747
  CheckPrototypes(object, a0, holder, a3, t0, a1, name, &miss);
2767
2748
 
2768
2749
  // Get the value from the cell.
2839
2820
    Handle<String> name,
2840
2821
    Handle<JSObject> receiver,
2841
2822
    Handle<JSObject> holder,
2842
 
    Handle<Object> value) {
 
2823
    Handle<JSFunction> value) {
2843
2824
  // ----------- S t a t e -------------
2844
2825
  //  -- ra    : return address
2845
2826
  //  -- a0    : key