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

« back to all changes in this revision

Viewing changes to src/x64/builtins-x64.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:
337
337
    __ push(rbx);
338
338
    __ push(rbx);
339
339
 
340
 
    // Setup pointer to last argument.
 
340
    // Set up pointer to last argument.
341
341
    __ lea(rbx, Operand(rbp, StandardFrameConstants::kCallerSPOffset));
342
342
 
343
343
    // Copy arguments and receiver to the expression stack.
1198
1198
// Both registers are preserved by this code so no need to differentiate between
1199
1199
// a construct call and a normal call.
1200
1200
static void ArrayNativeCode(MacroAssembler* masm,
1201
 
                            Label *call_generic_code) {
1202
 
  Label argc_one_or_more, argc_two_or_more, empty_array, not_empty_array;
 
1201
                            Label* call_generic_code) {
 
1202
  Label argc_one_or_more, argc_two_or_more, empty_array, not_empty_array,
 
1203
      has_non_smi_element;
1203
1204
 
1204
1205
  // Check for array construction with zero arguments.
1205
1206
  __ testq(rax, rax);
1305
1306
  __ jmp(&entry);
1306
1307
  __ bind(&loop);
1307
1308
  __ movq(kScratchRegister, Operand(r9, rcx, times_pointer_size, 0));
 
1309
  if (FLAG_smi_only_arrays) {
 
1310
    __ JumpIfNotSmi(kScratchRegister, &has_non_smi_element);
 
1311
  }
1308
1312
  __ movq(Operand(rdx, 0), kScratchRegister);
1309
1313
  __ addq(rdx, Immediate(kPointerSize));
1310
1314
  __ bind(&entry);
1321
1325
  __ push(rcx);
1322
1326
  __ movq(rax, rbx);
1323
1327
  __ ret(0);
 
1328
 
 
1329
  __ bind(&has_non_smi_element);
 
1330
  __ UndoAllocationInNewSpace(rbx);
 
1331
  __ jmp(call_generic_code);
 
1332
}
 
1333
 
 
1334
 
 
1335
void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) {
 
1336
  // ----------- S t a t e -------------
 
1337
  //  -- rax : argc
 
1338
  //  -- rsp[0] : return address
 
1339
  //  -- rsp[8] : last argument
 
1340
  // -----------------------------------
 
1341
  Label generic_array_code;
 
1342
 
 
1343
  // Get the InternalArray function.
 
1344
  __ LoadGlobalFunction(Context::INTERNAL_ARRAY_FUNCTION_INDEX, rdi);
 
1345
 
 
1346
  if (FLAG_debug_code) {
 
1347
    // Initial map for the builtin InternalArray functions should be maps.
 
1348
    __ movq(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset));
 
1349
    // Will both indicate a NULL and a Smi.
 
1350
    STATIC_ASSERT(kSmiTag == 0);
 
1351
    Condition not_smi = NegateCondition(masm->CheckSmi(rbx));
 
1352
    __ Check(not_smi, "Unexpected initial map for InternalArray function");
 
1353
    __ CmpObjectType(rbx, MAP_TYPE, rcx);
 
1354
    __ Check(equal, "Unexpected initial map for InternalArray function");
 
1355
  }
 
1356
 
 
1357
  // Run the native code for the InternalArray function called as a normal
 
1358
  // function.
 
1359
  ArrayNativeCode(masm, &generic_array_code);
 
1360
 
 
1361
  // Jump to the generic array code in case the specialized code cannot handle
 
1362
  // the construction.
 
1363
  __ bind(&generic_array_code);
 
1364
  Handle<Code> array_code =
 
1365
      masm->isolate()->builtins()->InternalArrayCodeGeneric();
 
1366
  __ Jump(array_code, RelocInfo::CODE_TARGET);
1324
1367
}
1325
1368
 
1326
1369
 
1504
1547
  __ bind(&invoke);
1505
1548
  __ call(rdx);
1506
1549
 
 
1550
  masm->isolate()->heap()->SetArgumentsAdaptorDeoptPCOffset(masm->pc_offset());
1507
1551
  // Leave frame and return.
1508
1552
  LeaveArgumentsAdaptorFrame(masm);
1509
1553
  __ ret(0);