blob: 6cc272c368458c45291c50842a60cf3c0a3a4730 [file] [log] [blame]
Steve Block44f0eee2011-05-26 01:26:41 +01001// Copyright 2011 the V8 project authors. All rights reserved.
2// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#include "v8.h"
29
30#if defined(V8_TARGET_ARCH_MIPS)
31
32#include "bootstrapper.h"
33#include "code-stubs.h"
34#include "codegen-inl.h"
35#include "regexp-macro-assembler.h"
36
37namespace v8 {
38namespace internal {
39
40
41#define __ ACCESS_MASM(masm)
42
43
44void ToNumberStub::Generate(MacroAssembler* masm) {
45 UNIMPLEMENTED_MIPS();
46}
47
48
49void FastNewClosureStub::Generate(MacroAssembler* masm) {
50 UNIMPLEMENTED_MIPS();
51}
52
53
54void FastNewContextStub::Generate(MacroAssembler* masm) {
55 UNIMPLEMENTED_MIPS();
56}
57
58
59void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) {
60 UNIMPLEMENTED_MIPS();
61}
62
63
64// Takes a Smi and converts to an IEEE 64 bit floating point value in two
65// registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and
66// 52 fraction bits (20 in the first word, 32 in the second). Zeros is a
67// scratch register. Destroys the source register. No GC occurs during this
68// stub so you don't have to set up the frame.
69class ConvertToDoubleStub : public CodeStub {
70 public:
71 ConvertToDoubleStub(Register result_reg_1,
72 Register result_reg_2,
73 Register source_reg,
74 Register scratch_reg)
75 : result1_(result_reg_1),
76 result2_(result_reg_2),
77 source_(source_reg),
78 zeros_(scratch_reg) { }
79
80 private:
81 Register result1_;
82 Register result2_;
83 Register source_;
84 Register zeros_;
85
86 // Minor key encoding in 16 bits.
87 class ModeBits: public BitField<OverwriteMode, 0, 2> {};
88 class OpBits: public BitField<Token::Value, 2, 14> {};
89
90 Major MajorKey() { return ConvertToDouble; }
91 int MinorKey() {
92 // Encode the parameters in a unique 16 bit value.
93 return result1_.code() +
94 (result2_.code() << 4) +
95 (source_.code() << 8) +
96 (zeros_.code() << 12);
97 }
98
99 void Generate(MacroAssembler* masm);
100
101 const char* GetName() { return "ConvertToDoubleStub"; }
102
103#ifdef DEBUG
104 void Print() { PrintF("ConvertToDoubleStub\n"); }
105#endif
106};
107
108
109void ConvertToDoubleStub::Generate(MacroAssembler* masm) {
110 UNIMPLEMENTED_MIPS();
111}
112
113
114class FloatingPointHelper : public AllStatic {
115 public:
116
117 enum Destination {
118 kFPURegisters,
119 kCoreRegisters
120 };
121
122
123 // Loads smis from a0 and a1 (right and left in binary operations) into
124 // floating point registers. Depending on the destination the values ends up
125 // either f14 and f12 or in a2/a3 and a0/a1 respectively. If the destination
126 // is floating point registers FPU must be supported. If core registers are
127 // requested when FPU is supported f12 and f14 will be scratched.
128 static void LoadSmis(MacroAssembler* masm,
129 Destination destination,
130 Register scratch1,
131 Register scratch2);
132
133 // Loads objects from a0 and a1 (right and left in binary operations) into
134 // floating point registers. Depending on the destination the values ends up
135 // either f14 and f12 or in a2/a3 and a0/a1 respectively. If the destination
136 // is floating point registers FPU must be supported. If core registers are
137 // requested when FPU is supported f12 and f14 will still be scratched. If
138 // either a0 or a1 is not a number (not smi and not heap number object) the
139 // not_number label is jumped to with a0 and a1 intact.
140 static void LoadOperands(MacroAssembler* masm,
141 FloatingPointHelper::Destination destination,
142 Register heap_number_map,
143 Register scratch1,
144 Register scratch2,
145 Label* not_number);
146 // Loads the number from object into dst as a 32-bit integer if possible. If
147 // the object is not a 32-bit integer control continues at the label
148 // not_int32. If FPU is supported double_scratch is used but not scratch2.
149 static void LoadNumberAsInteger(MacroAssembler* masm,
150 Register object,
151 Register dst,
152 Register heap_number_map,
153 Register scratch1,
154 Register scratch2,
155 FPURegister double_scratch,
156 Label* not_int32);
157 private:
158 static void LoadNumber(MacroAssembler* masm,
159 FloatingPointHelper::Destination destination,
160 Register object,
161 FPURegister dst,
162 Register dst1,
163 Register dst2,
164 Register heap_number_map,
165 Register scratch1,
166 Register scratch2,
167 Label* not_number);
168};
169
170
171void FloatingPointHelper::LoadSmis(MacroAssembler* masm,
172 FloatingPointHelper::Destination destination,
173 Register scratch1,
174 Register scratch2) {
175 UNIMPLEMENTED_MIPS();
176}
177
178
179void FloatingPointHelper::LoadOperands(
180 MacroAssembler* masm,
181 FloatingPointHelper::Destination destination,
182 Register heap_number_map,
183 Register scratch1,
184 Register scratch2,
185 Label* slow) {
186 UNIMPLEMENTED_MIPS();
187}
188
189
190void FloatingPointHelper::LoadNumber(MacroAssembler* masm,
191 Destination destination,
192 Register object,
193 FPURegister dst,
194 Register dst1,
195 Register dst2,
196 Register heap_number_map,
197 Register scratch1,
198 Register scratch2,
199 Label* not_number) {
200 UNIMPLEMENTED_MIPS();
201}
202
203
204void FloatingPointHelper::LoadNumberAsInteger(MacroAssembler* masm,
205 Register object,
206 Register dst,
207 Register heap_number_map,
208 Register scratch1,
209 Register scratch2,
210 FPURegister double_scratch,
211 Label* not_int32) {
212 UNIMPLEMENTED_MIPS();
213}
214
215
216// See comment for class, this does NOT work for int32's that are in Smi range.
217void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) {
218 UNIMPLEMENTED_MIPS();
219}
220
221
222void EmitNanCheck(MacroAssembler* masm, Condition cc) {
223 UNIMPLEMENTED_MIPS();
224}
225
226
227void NumberToStringStub::GenerateLookupNumberStringCache(MacroAssembler* masm,
228 Register object,
229 Register result,
230 Register scratch1,
231 Register scratch2,
232 Register scratch3,
233 bool object_is_smi,
234 Label* not_found) {
235 UNIMPLEMENTED_MIPS();
236}
237
238
239void NumberToStringStub::Generate(MacroAssembler* masm) {
240 UNIMPLEMENTED_MIPS();
241}
242
243
244// On entry lhs_ (lhs) and rhs_ (rhs) are the things to be compared.
245// On exit, v0 is 0, positive, or negative (smi) to indicate the result
246// of the comparison.
247void CompareStub::Generate(MacroAssembler* masm) {
248 UNIMPLEMENTED_MIPS();
249}
250
251
252// This stub does not handle the inlined cases (Smis, Booleans, undefined).
253// The stub returns zero for false, and a non-zero value for true.
254void ToBooleanStub::Generate(MacroAssembler* masm) {
255 UNIMPLEMENTED_MIPS();
256}
257
258
259// We fall into this code if the operands were Smis, but the result was
260// not (eg. overflow). We branch into this code (to the not_smi label) if
261// the operands were not both Smi. The operands are in lhs and rhs.
262// To call the C-implemented binary fp operation routines we need to end up
263// with the double precision floating point operands in a0 and a1 (for the
264// value in a1) and a2 and a3 (for the value in a0).
265void GenericBinaryOpStub::HandleBinaryOpSlowCases(MacroAssembler* masm,
266 Label* not_smi,
267 Register lhs,
268 Register rhs,
269 const Builtins::JavaScript& builtin) {
270 UNIMPLEMENTED_MIPS();
271}
272
273
274// For bitwise ops where the inputs are not both Smis we here try to determine
275// whether both inputs are either Smis or at least heap numbers that can be
276// represented by a 32 bit signed value. We truncate towards zero as required
277// by the ES spec. If this is the case we do the bitwise op and see if the
278// result is a Smi. If so, great, otherwise we try to find a heap number to
279// write the answer into (either by allocating or by overwriting).
280// On entry the operands are in lhs (x) and rhs (y). (Result = x op y).
281// On exit the result is in v0.
282void GenericBinaryOpStub::HandleNonSmiBitwiseOp(MacroAssembler* masm,
283 Register lhs,
284 Register rhs) {
285 UNIMPLEMENTED_MIPS();
286}
287
288
289void GenericBinaryOpStub::Generate(MacroAssembler* masm) {
290 UNIMPLEMENTED_MIPS();
291}
292
293
294void GenericBinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) {
295 UNIMPLEMENTED_MIPS();
296}
297
298
299Handle<Code> GetBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) {
300 GenericBinaryOpStub stub(key, type_info);
301 return stub.GetCode();
302}
303
304
305Handle<Code> GetTypeRecordingBinaryOpStub(int key,
306 TRBinaryOpIC::TypeInfo type_info,
307 TRBinaryOpIC::TypeInfo result_type_info) {
308 TypeRecordingBinaryOpStub stub(key, type_info, result_type_info);
309 return stub.GetCode();
310}
311
312
313void TypeRecordingBinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) {
314 UNIMPLEMENTED_MIPS();
315}
316
317
318void TypeRecordingBinaryOpStub::GenerateTypeTransitionWithSavedArgs(
319 MacroAssembler* masm) {
320 UNIMPLEMENTED();
321}
322
323
324void TypeRecordingBinaryOpStub::Generate(MacroAssembler* masm) {
325 UNIMPLEMENTED_MIPS();
326}
327
328
329const char* TypeRecordingBinaryOpStub::GetName() {
330 UNIMPLEMENTED_MIPS();
331 return name_;
332}
333
334
335
336void TypeRecordingBinaryOpStub::GenerateSmiSmiOperation(
337 MacroAssembler* masm) {
338 UNIMPLEMENTED_MIPS();
339}
340
341
342void TypeRecordingBinaryOpStub::GenerateFPOperation(MacroAssembler* masm,
343 bool smi_operands,
344 Label* not_numbers,
345 Label* gc_required) {
346 UNIMPLEMENTED_MIPS();
347}
348
349
350// Generate the smi code. If the operation on smis are successful this return is
351// generated. If the result is not a smi and heap number allocation is not
352// requested the code falls through. If number allocation is requested but a
353// heap number cannot be allocated the code jumps to the lable gc_required.
354void TypeRecordingBinaryOpStub::GenerateSmiCode(MacroAssembler* masm,
355 Label* gc_required,
356 SmiCodeGenerateHeapNumberResults allow_heapnumber_results) {
357 UNIMPLEMENTED_MIPS();
358}
359
360
361void TypeRecordingBinaryOpStub::GenerateSmiStub(MacroAssembler* masm) {
362 UNIMPLEMENTED_MIPS();
363}
364
365
366void TypeRecordingBinaryOpStub::GenerateStringStub(MacroAssembler* masm) {
367 UNIMPLEMENTED_MIPS();
368}
369
370
371void TypeRecordingBinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) {
372 UNIMPLEMENTED_MIPS();
373}
374
375
376void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) {
377 UNIMPLEMENTED_MIPS();
378}
379
380
381void TypeRecordingBinaryOpStub::GenerateGeneric(MacroAssembler* masm) {
382 UNIMPLEMENTED_MIPS();
383}
384
385
386void TypeRecordingBinaryOpStub::GenerateAddStrings(MacroAssembler* masm) {
387 UNIMPLEMENTED_MIPS();
388}
389
390
391void TypeRecordingBinaryOpStub::GenerateCallRuntime(MacroAssembler* masm) {
392 UNIMPLEMENTED_MIPS();
393}
394
395
396void TypeRecordingBinaryOpStub::GenerateHeapResultAllocation(
397 MacroAssembler* masm,
398 Register result,
399 Register heap_number_map,
400 Register scratch1,
401 Register scratch2,
402 Label* gc_required) {
403 UNIMPLEMENTED_MIPS();
404}
405
406
407void TypeRecordingBinaryOpStub::GenerateRegisterArgsPush(MacroAssembler* masm) {
408 UNIMPLEMENTED_MIPS();
409}
410
411
412
413void TranscendentalCacheStub::Generate(MacroAssembler* masm) {
414 UNIMPLEMENTED_MIPS();
415}
416
417
418Runtime::FunctionId TranscendentalCacheStub::RuntimeFunction() {
419 UNIMPLEMENTED_MIPS();
420 return Runtime::kAbort;
421}
422
423
424void StackCheckStub::Generate(MacroAssembler* masm) {
425 UNIMPLEMENTED_MIPS();
426}
427
428
429void GenericUnaryOpStub::Generate(MacroAssembler* masm) {
430 UNIMPLEMENTED_MIPS();
431}
432
433
434bool CEntryStub::NeedsImmovableCode() {
435 return true;
436}
437
438
439void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
440 UNIMPLEMENTED_MIPS();
441}
442
443
444void CEntryStub::GenerateThrowUncatchable(MacroAssembler* masm,
445 UncatchableExceptionType type) {
446 UNIMPLEMENTED_MIPS();
447}
448
449
450void CEntryStub::GenerateCore(MacroAssembler* masm,
451 Label* throw_normal_exception,
452 Label* throw_termination_exception,
453 Label* throw_out_of_memory_exception,
454 bool do_gc,
455 bool always_allocate) {
456 UNIMPLEMENTED_MIPS();
457}
458
459
460void CEntryStub::Generate(MacroAssembler* masm) {
461 UNIMPLEMENTED_MIPS();
462}
463
464
465void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
466 UNIMPLEMENTED_MIPS();
467}
468
469
470// Uses registers a0 to t0. Expected input is
471// object in a0 (or at sp+1*kPointerSize) and function in
472// a1 (or at sp), depending on whether or not
473// args_in_registers() is true.
474void InstanceofStub::Generate(MacroAssembler* masm) {
475 UNIMPLEMENTED_MIPS();
476}
477
478
479void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
480 UNIMPLEMENTED_MIPS();
481}
482
483
484void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) {
485 UNIMPLEMENTED_MIPS();
486}
487
488
489void RegExpExecStub::Generate(MacroAssembler* masm) {
490 UNIMPLEMENTED_MIPS();
491}
492
493
494void RegExpConstructResultStub::Generate(MacroAssembler* masm) {
495 UNIMPLEMENTED_MIPS();
496}
497
498
499void CallFunctionStub::Generate(MacroAssembler* masm) {
500 UNIMPLEMENTED_MIPS();
501}
502
503
504// Unfortunately you have to run without snapshots to see most of these
505// names in the profile since most compare stubs end up in the snapshot.
506const char* CompareStub::GetName() {
507 UNIMPLEMENTED_MIPS();
508 return name_;
509}
510
511
512int CompareStub::MinorKey() {
513 UNIMPLEMENTED_MIPS();
514 return 0;
515}
516
517
518// StringCharCodeAtGenerator
519
520void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {
521 UNIMPLEMENTED_MIPS();
522}
523
524
525void StringCharCodeAtGenerator::GenerateSlow(
526 MacroAssembler* masm, const RuntimeCallHelper& call_helper) {
527 UNIMPLEMENTED_MIPS();
528}
529
530
531// -------------------------------------------------------------------------
532// StringCharFromCodeGenerator
533
534void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) {
535 UNIMPLEMENTED_MIPS();
536}
537
538
539void StringCharFromCodeGenerator::GenerateSlow(
540 MacroAssembler* masm, const RuntimeCallHelper& call_helper) {
541 UNIMPLEMENTED_MIPS();
542}
543
544
545// -------------------------------------------------------------------------
546// StringCharAtGenerator
547
548void StringCharAtGenerator::GenerateFast(MacroAssembler* masm) {
549 UNIMPLEMENTED_MIPS();
550}
551
552
553void StringCharAtGenerator::GenerateSlow(
554 MacroAssembler* masm, const RuntimeCallHelper& call_helper) {
555 UNIMPLEMENTED_MIPS();
556}
557
558
559class StringHelper : public AllStatic {
560 public:
561 // Generate code for copying characters using a simple loop. This should only
562 // be used in places where the number of characters is small and the
563 // additional setup and checking in GenerateCopyCharactersLong adds too much
564 // overhead. Copying of overlapping regions is not supported.
565 // Dest register ends at the position after the last character written.
566 static void GenerateCopyCharacters(MacroAssembler* masm,
567 Register dest,
568 Register src,
569 Register count,
570 Register scratch,
571 bool ascii);
572
573 // Generate code for copying a large number of characters. This function
574 // is allowed to spend extra time setting up conditions to make copying
575 // faster. Copying of overlapping regions is not supported.
576 // Dest register ends at the position after the last character written.
577 static void GenerateCopyCharactersLong(MacroAssembler* masm,
578 Register dest,
579 Register src,
580 Register count,
581 Register scratch1,
582 Register scratch2,
583 Register scratch3,
584 Register scratch4,
585 Register scratch5,
586 int flags);
587
588
589 // Probe the symbol table for a two character string. If the string is
590 // not found by probing a jump to the label not_found is performed. This jump
591 // does not guarantee that the string is not in the symbol table. If the
592 // string is found the code falls through with the string in register r0.
593 // Contents of both c1 and c2 registers are modified. At the exit c1 is
594 // guaranteed to contain halfword with low and high bytes equal to
595 // initial contents of c1 and c2 respectively.
596 static void GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm,
597 Register c1,
598 Register c2,
599 Register scratch1,
600 Register scratch2,
601 Register scratch3,
602 Register scratch4,
603 Register scratch5,
604 Label* not_found);
605
606 // Generate string hash.
607 static void GenerateHashInit(MacroAssembler* masm,
608 Register hash,
609 Register character);
610
611 static void GenerateHashAddCharacter(MacroAssembler* masm,
612 Register hash,
613 Register character);
614
615 static void GenerateHashGetHash(MacroAssembler* masm,
616 Register hash);
617
618 private:
619 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
620};
621
622
623void StringHelper::GenerateCopyCharacters(MacroAssembler* masm,
624 Register dest,
625 Register src,
626 Register count,
627 Register scratch,
628 bool ascii) {
629 UNIMPLEMENTED_MIPS();
630}
631
632
633enum CopyCharactersFlags {
634 COPY_ASCII = 1,
635 DEST_ALWAYS_ALIGNED = 2
636};
637
638
639void StringHelper::GenerateCopyCharactersLong(MacroAssembler* masm,
640 Register dest,
641 Register src,
642 Register count,
643 Register scratch1,
644 Register scratch2,
645 Register scratch3,
646 Register scratch4,
647 Register scratch5,
648 int flags) {
649 UNIMPLEMENTED_MIPS();
650}
651
652
653void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm,
654 Register c1,
655 Register c2,
656 Register scratch1,
657 Register scratch2,
658 Register scratch3,
659 Register scratch4,
660 Register scratch5,
661 Label* not_found) {
662 UNIMPLEMENTED_MIPS();
663}
664
665
666void StringHelper::GenerateHashInit(MacroAssembler* masm,
667 Register hash,
668 Register character) {
669 UNIMPLEMENTED_MIPS();
670}
671
672
673void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm,
674 Register hash,
675 Register character) {
676 UNIMPLEMENTED_MIPS();
677}
678
679
680void StringHelper::GenerateHashGetHash(MacroAssembler* masm,
681 Register hash) {
682 UNIMPLEMENTED_MIPS();
683}
684
685
686void SubStringStub::Generate(MacroAssembler* masm) {
687 UNIMPLEMENTED_MIPS();
688}
689
690
691void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
692 Register right,
693 Register left,
694 Register scratch1,
695 Register scratch2,
696 Register scratch3,
697 Register scratch4) {
698 UNIMPLEMENTED_MIPS();
699}
700
701
702void StringCompareStub::Generate(MacroAssembler* masm) {
703 UNIMPLEMENTED_MIPS();
704}
705
706
707void StringAddStub::Generate(MacroAssembler* masm) {
708 UNIMPLEMENTED_MIPS();
709}
710
711
712void ICCompareStub::GenerateSmis(MacroAssembler* masm) {
713 UNIMPLEMENTED_MIPS();
714}
715
716
717void ICCompareStub::GenerateHeapNumbers(MacroAssembler* masm) {
718 UNIMPLEMENTED_MIPS();
719}
720
721
722void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
723 UNIMPLEMENTED_MIPS();
724}
725
726
727void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
728 UNIMPLEMENTED_MIPS();
729}
730
731
732void GenerateFastPixelArrayLoad(MacroAssembler* masm,
733 Register receiver,
734 Register key,
735 Register elements_map,
736 Register elements,
737 Register scratch1,
738 Register scratch2,
739 Register result,
740 Label* not_pixel_array,
741 Label* key_not_smi,
742 Label* out_of_range) {
743 UNIMPLEMENTED_MIPS();
744}
745
746
747#undef __
748
749} } // namespace v8::internal
750
751#endif // V8_TARGET_ARCH_MIPS
752