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 21 matching lines...) Expand all Loading... |
32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
33 #include "code-stubs.h" | 33 #include "code-stubs.h" |
34 #include "codegen.h" | 34 #include "codegen.h" |
35 #include "regexp-macro-assembler.h" | 35 #include "regexp-macro-assembler.h" |
36 #include "stub-cache.h" | 36 #include "stub-cache.h" |
37 | 37 |
38 namespace v8 { | 38 namespace v8 { |
39 namespace internal { | 39 namespace internal { |
40 | 40 |
41 | 41 |
| 42 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( |
| 43 Isolate* isolate, |
| 44 CodeStubInterfaceDescriptor* descriptor) { |
| 45 static Register registers[] = { a3, a2, a1, a0 }; |
| 46 descriptor->register_param_count_ = 4; |
| 47 descriptor->register_params_ = registers; |
| 48 descriptor->stack_parameter_count_ = NULL; |
| 49 descriptor->deoptimization_handler_ = |
| 50 Runtime::FunctionForId(Runtime::kCreateObjectLiteralShallow)->entry; |
| 51 } |
| 52 |
| 53 |
42 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( | 54 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( |
43 Isolate* isolate, | 55 Isolate* isolate, |
44 CodeStubInterfaceDescriptor* descriptor) { | 56 CodeStubInterfaceDescriptor* descriptor) { |
45 static Register registers[] = { a1, a0 }; | 57 static Register registers[] = { a1, a0 }; |
46 descriptor->register_param_count_ = 2; | 58 descriptor->register_param_count_ = 2; |
47 descriptor->register_params_ = registers; | 59 descriptor->register_params_ = registers; |
48 descriptor->deoptimization_handler_ = | 60 descriptor->deoptimization_handler_ = |
49 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); | 61 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); |
50 } | 62 } |
51 | 63 |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 &slow_case); | 503 &slow_case); |
492 | 504 |
493 // Return and remove the on-stack parameters. | 505 // Return and remove the on-stack parameters. |
494 __ DropAndRet(3); | 506 __ DropAndRet(3); |
495 | 507 |
496 __ bind(&slow_case); | 508 __ bind(&slow_case); |
497 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); | 509 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); |
498 } | 510 } |
499 | 511 |
500 | 512 |
501 void FastCloneShallowObjectStub::Generate(MacroAssembler* masm) { | |
502 // Stack layout on entry: | |
503 // | |
504 // [sp]: object literal flags. | |
505 // [sp + kPointerSize]: constant properties. | |
506 // [sp + (2 * kPointerSize)]: literal index. | |
507 // [sp + (3 * kPointerSize)]: literals array. | |
508 | |
509 // Load boilerplate object into a3 and check if we need to create a | |
510 // boilerplate. | |
511 Label slow_case; | |
512 __ lw(a3, MemOperand(sp, 3 * kPointerSize)); | |
513 __ lw(a0, MemOperand(sp, 2 * kPointerSize)); | |
514 __ Addu(a3, a3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
515 __ sll(t0, a0, kPointerSizeLog2 - kSmiTagSize); | |
516 __ Addu(a3, t0, a3); | |
517 __ lw(a3, MemOperand(a3)); | |
518 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex); | |
519 __ Branch(&slow_case, eq, a3, Operand(t0)); | |
520 | |
521 // Check that the boilerplate contains only fast properties and we can | |
522 // statically determine the instance size. | |
523 int size = JSObject::kHeaderSize + length_ * kPointerSize; | |
524 __ lw(a0, FieldMemOperand(a3, HeapObject::kMapOffset)); | |
525 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceSizeOffset)); | |
526 __ Branch(&slow_case, ne, a0, Operand(size >> kPointerSizeLog2)); | |
527 | |
528 // Allocate the JS object and copy header together with all in-object | |
529 // properties from the boilerplate. | |
530 __ AllocateInNewSpace(size, v0, a1, a2, &slow_case, TAG_OBJECT); | |
531 for (int i = 0; i < size; i += kPointerSize) { | |
532 __ lw(a1, FieldMemOperand(a3, i)); | |
533 __ sw(a1, FieldMemOperand(v0, i)); | |
534 } | |
535 | |
536 // Return and remove the on-stack parameters. | |
537 __ DropAndRet(4); | |
538 | |
539 __ bind(&slow_case); | |
540 __ TailCallRuntime(Runtime::kCreateObjectLiteralShallow, 4, 1); | |
541 } | |
542 | |
543 | |
544 // Takes a Smi and converts to an IEEE 64 bit floating point value in two | 513 // Takes a Smi and converts to an IEEE 64 bit floating point value in two |
545 // registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and | 514 // registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and |
546 // 52 fraction bits (20 in the first word, 32 in the second). Zeros is a | 515 // 52 fraction bits (20 in the first word, 32 in the second). Zeros is a |
547 // scratch register. Destroys the source register. No GC occurs during this | 516 // scratch register. Destroys the source register. No GC occurs during this |
548 // stub so you don't have to set up the frame. | 517 // stub so you don't have to set up the frame. |
549 class ConvertToDoubleStub : public PlatformCodeStub { | 518 class ConvertToDoubleStub : public PlatformCodeStub { |
550 public: | 519 public: |
551 ConvertToDoubleStub(Register result_reg_1, | 520 ConvertToDoubleStub(Register result_reg_1, |
552 Register result_reg_2, | 521 Register result_reg_2, |
553 Register source_reg, | 522 Register source_reg, |
(...skipping 7507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8061 __ Pop(ra, t1, a1); | 8030 __ Pop(ra, t1, a1); |
8062 __ Ret(); | 8031 __ Ret(); |
8063 } | 8032 } |
8064 | 8033 |
8065 | 8034 |
8066 #undef __ | 8035 #undef __ |
8067 | 8036 |
8068 } } // namespace v8::internal | 8037 } } // namespace v8::internal |
8069 | 8038 |
8070 #endif // V8_TARGET_ARCH_MIPS | 8039 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |