v8  3.11.10(node0.8.26)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
builtins-mips.cc
Go to the documentation of this file.
1 // Copyright 2012 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 
29 
30 #include "v8.h"
31 
32 #if defined(V8_TARGET_ARCH_MIPS)
33 
34 #include "codegen.h"
35 #include "debug.h"
36 #include "deoptimizer.h"
37 #include "full-codegen.h"
38 #include "runtime.h"
39 
40 namespace v8 {
41 namespace internal {
42 
43 
44 #define __ ACCESS_MASM(masm)
45 
46 
47 void Builtins::Generate_Adaptor(MacroAssembler* masm,
48  CFunctionId id,
49  BuiltinExtraArguments extra_args) {
50  // ----------- S t a t e -------------
51  // -- a0 : number of arguments excluding receiver
52  // -- a1 : called function (only guaranteed when
53  // -- extra_args requires it)
54  // -- cp : context
55  // -- sp[0] : last argument
56  // -- ...
57  // -- sp[4 * (argc - 1)] : first argument
58  // -- sp[4 * agrc] : receiver
59  // -----------------------------------
60 
61  // Insert extra arguments.
62  int num_extra_args = 0;
63  if (extra_args == NEEDS_CALLED_FUNCTION) {
64  num_extra_args = 1;
65  __ push(a1);
66  } else {
67  ASSERT(extra_args == NO_EXTRA_ARGUMENTS);
68  }
69 
70  // JumpToExternalReference expects s0 to contain the number of arguments
71  // including the receiver and the extra arguments.
72  __ Addu(s0, a0, num_extra_args + 1);
73  __ sll(s1, s0, kPointerSizeLog2);
74  __ Subu(s1, s1, kPointerSize);
75  __ JumpToExternalReference(ExternalReference(id, masm->isolate()));
76 }
77 
78 
79 // Load the built-in InternalArray function from the current context.
80 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm,
81  Register result) {
82  // Load the global context.
83 
85  __ lw(result,
87  // Load the InternalArray function from the global context.
88  __ lw(result,
89  MemOperand(result,
92 }
93 
94 
95 // Load the built-in Array function from the current context.
96 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) {
97  // Load the global context.
98 
100  __ lw(result,
102  // Load the Array function from the global context.
103  __ lw(result,
104  MemOperand(result,
106 }
107 
108 
109 // Allocate an empty JSArray. The allocated array is put into the result
110 // register. An elements backing store is allocated with size initial_capacity
111 // and filled with the hole values.
112 static void AllocateEmptyJSArray(MacroAssembler* masm,
113  Register array_function,
114  Register result,
115  Register scratch1,
116  Register scratch2,
117  Register scratch3,
118  Label* gc_required) {
119  const int initial_capacity = JSArray::kPreallocatedArrayElements;
120  STATIC_ASSERT(initial_capacity >= 0);
121  __ LoadInitialArrayMap(array_function, scratch2, scratch1, false);
122 
123  // Allocate the JSArray object together with space for a fixed array with the
124  // requested elements.
125  int size = JSArray::kSize;
126  if (initial_capacity > 0) {
127  size += FixedArray::SizeFor(initial_capacity);
128  }
129  __ AllocateInNewSpace(size,
130  result,
131  scratch2,
132  scratch3,
133  gc_required,
134  TAG_OBJECT);
135  // Allocated the JSArray. Now initialize the fields except for the elements
136  // array.
137  // result: JSObject
138  // scratch1: initial map
139  // scratch2: start of next object
140  __ sw(scratch1, FieldMemOperand(result, JSObject::kMapOffset));
141  __ LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex);
142  __ sw(scratch1, FieldMemOperand(result, JSArray::kPropertiesOffset));
143  // Field JSArray::kElementsOffset is initialized later.
144  __ mov(scratch3, zero_reg);
145  __ sw(scratch3, FieldMemOperand(result, JSArray::kLengthOffset));
146 
147  if (initial_capacity == 0) {
148  __ sw(scratch1, FieldMemOperand(result, JSArray::kElementsOffset));
149  return;
150  }
151 
152  // Calculate the location of the elements array and set elements array member
153  // of the JSArray.
154  // result: JSObject
155  // scratch2: start of next object
156  __ Addu(scratch1, result, Operand(JSArray::kSize));
157  __ sw(scratch1, FieldMemOperand(result, JSArray::kElementsOffset));
158 
159  // Clear the heap tag on the elements array.
160  __ And(scratch1, scratch1, Operand(~kHeapObjectTagMask));
161 
162  // Initialize the FixedArray and fill it with holes. FixedArray length is
163  // stored as a smi.
164  // result: JSObject
165  // scratch1: elements array (untagged)
166  // scratch2: start of next object
167  __ LoadRoot(scratch3, Heap::kFixedArrayMapRootIndex);
169  __ sw(scratch3, MemOperand(scratch1));
170  __ Addu(scratch1, scratch1, kPointerSize);
171  __ li(scratch3, Operand(Smi::FromInt(initial_capacity)));
173  __ sw(scratch3, MemOperand(scratch1));
174  __ Addu(scratch1, scratch1, kPointerSize);
175 
176  // Fill the FixedArray with the hole value. Inline the code if short.
178  __ LoadRoot(scratch3, Heap::kTheHoleValueRootIndex);
179  static const int kLoopUnfoldLimit = 4;
180  if (initial_capacity <= kLoopUnfoldLimit) {
181  for (int i = 0; i < initial_capacity; i++) {
182  __ sw(scratch3, MemOperand(scratch1, i * kPointerSize));
183  }
184  } else {
185  Label loop, entry;
186  __ Addu(scratch2, scratch1, Operand(initial_capacity * kPointerSize));
187  __ Branch(&entry);
188  __ bind(&loop);
189  __ sw(scratch3, MemOperand(scratch1));
190  __ Addu(scratch1, scratch1, kPointerSize);
191  __ bind(&entry);
192  __ Branch(&loop, lt, scratch1, Operand(scratch2));
193  }
194 }
195 
196 
197 // Allocate a JSArray with the number of elements stored in a register. The
198 // register array_function holds the built-in Array function and the register
199 // array_size holds the size of the array as a smi. The allocated array is put
200 // into the result register and beginning and end of the FixedArray elements
201 // storage is put into registers elements_array_storage and elements_array_end
202 // (see below for when that is not the case). If the parameter fill_with_holes
203 // is true the allocated elements backing store is filled with the hole values
204 // otherwise it is left uninitialized. When the backing store is filled the
205 // register elements_array_storage is scratched.
206 static void AllocateJSArray(MacroAssembler* masm,
207  Register array_function, // Array function.
208  Register array_size, // As a smi, cannot be 0.
209  Register result,
210  Register elements_array_storage,
211  Register elements_array_end,
212  Register scratch1,
213  Register scratch2,
214  bool fill_with_hole,
215  Label* gc_required) {
216  // Load the initial map from the array function.
217  __ LoadInitialArrayMap(array_function, scratch2,
218  elements_array_storage, fill_with_hole);
219 
220  if (FLAG_debug_code) { // Assert that array size is not zero.
221  __ Assert(
222  ne, "array size is unexpectedly 0", array_size, Operand(zero_reg));
223  }
224 
225  // Allocate the JSArray object together with space for a FixedArray with the
226  // requested number of elements.
227  STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
228  __ li(elements_array_end,
230  __ sra(scratch1, array_size, kSmiTagSize);
231  __ Addu(elements_array_end, elements_array_end, scratch1);
232  __ AllocateInNewSpace(
233  elements_array_end,
234  result,
235  scratch1,
236  scratch2,
237  gc_required,
238  static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS));
239 
240  // Allocated the JSArray. Now initialize the fields except for the elements
241  // array.
242  // result: JSObject
243  // elements_array_storage: initial map
244  // array_size: size of array (smi)
245  __ sw(elements_array_storage, FieldMemOperand(result, JSObject::kMapOffset));
246  __ LoadRoot(elements_array_storage, Heap::kEmptyFixedArrayRootIndex);
247  __ sw(elements_array_storage,
249  // Field JSArray::kElementsOffset is initialized later.
250  __ sw(array_size, FieldMemOperand(result, JSArray::kLengthOffset));
251 
252  // Calculate the location of the elements array and set elements array member
253  // of the JSArray.
254  // result: JSObject
255  // array_size: size of array (smi)
256  __ Addu(elements_array_storage, result, Operand(JSArray::kSize));
257  __ sw(elements_array_storage,
259 
260  // Clear the heap tag on the elements array.
261  __ And(elements_array_storage,
262  elements_array_storage,
263  Operand(~kHeapObjectTagMask));
264  // Initialize the fixed array and fill it with holes. FixedArray length is
265  // stored as a smi.
266  // result: JSObject
267  // elements_array_storage: elements array (untagged)
268  // array_size: size of array (smi)
269  __ LoadRoot(scratch1, Heap::kFixedArrayMapRootIndex);
271  __ sw(scratch1, MemOperand(elements_array_storage));
272  __ Addu(elements_array_storage, elements_array_storage, kPointerSize);
273 
274  // Length of the FixedArray is the number of pre-allocated elements if
275  // the actual JSArray has length 0 and the size of the JSArray for non-empty
276  // JSArrays. The length of a FixedArray is stored as a smi.
277  STATIC_ASSERT(kSmiTag == 0);
278 
280  __ sw(array_size, MemOperand(elements_array_storage));
281  __ Addu(elements_array_storage, elements_array_storage, kPointerSize);
282 
283  // Calculate elements array and elements array end.
284  // result: JSObject
285  // elements_array_storage: elements array element storage
286  // array_size: smi-tagged size of elements array
288  __ sll(elements_array_end, array_size, kPointerSizeLog2 - kSmiTagSize);
289  __ Addu(elements_array_end, elements_array_storage, elements_array_end);
290 
291  // Fill the allocated FixedArray with the hole value if requested.
292  // result: JSObject
293  // elements_array_storage: elements array element storage
294  // elements_array_end: start of next object
295  if (fill_with_hole) {
296  Label loop, entry;
297  __ LoadRoot(scratch1, Heap::kTheHoleValueRootIndex);
298  __ Branch(&entry);
299  __ bind(&loop);
300  __ sw(scratch1, MemOperand(elements_array_storage));
301  __ Addu(elements_array_storage, elements_array_storage, kPointerSize);
302 
303  __ bind(&entry);
304  __ Branch(&loop, lt, elements_array_storage, Operand(elements_array_end));
305  }
306 }
307 
308 
309 // Create a new array for the built-in Array function. This function allocates
310 // the JSArray object and the FixedArray elements array and initializes these.
311 // If the Array cannot be constructed in native code the runtime is called. This
312 // function assumes the following state:
313 // a0: argc
314 // a1: constructor (built-in Array function)
315 // ra: return address
316 // sp[0]: last argument
317 // This function is used for both construct and normal calls of Array. The only
318 // difference between handling a construct call and a normal call is that for a
319 // construct call the constructor function in a1 needs to be preserved for
320 // entering the generic code. In both cases argc in a0 needs to be preserved.
321 // Both registers are preserved by this code so no need to differentiate between
322 // construct call and normal call.
323 static void ArrayNativeCode(MacroAssembler* masm,
324  Label* call_generic_code) {
325  Counters* counters = masm->isolate()->counters();
326  Label argc_one_or_more, argc_two_or_more, not_empty_array, empty_array,
327  has_non_smi_element, finish, cant_transition_map, not_double;
328 
329  // Check for array construction with zero arguments or one.
330  __ Branch(&argc_one_or_more, ne, a0, Operand(zero_reg));
331  // Handle construction of an empty array.
332  __ bind(&empty_array);
333  AllocateEmptyJSArray(masm,
334  a1,
335  a2,
336  a3,
337  t0,
338  t1,
339  call_generic_code);
340  __ IncrementCounter(counters->array_function_native(), 1, a3, t0);
341  // Set up return value, remove receiver from stack and return.
342  __ mov(v0, a2);
343  __ Addu(sp, sp, Operand(kPointerSize));
344  __ Ret();
345 
346  // Check for one argument. Bail out if argument is not smi or if it is
347  // negative.
348  __ bind(&argc_one_or_more);
349  __ Branch(&argc_two_or_more, ne, a0, Operand(1));
350 
351  STATIC_ASSERT(kSmiTag == 0);
352  __ lw(a2, MemOperand(sp)); // Get the argument from the stack.
353  __ Branch(&not_empty_array, ne, a2, Operand(zero_reg));
354  __ Drop(1); // Adjust stack.
355  __ mov(a0, zero_reg); // Treat this as a call with argc of zero.
356  __ Branch(&empty_array);
357 
358  __ bind(&not_empty_array);
359  __ And(a3, a2, Operand(kIntptrSignBit | kSmiTagMask));
360  __ Branch(call_generic_code, eq, a3, Operand(zero_reg));
361 
362  // Handle construction of an empty array of a certain size. Bail out if size
363  // is too large to actually allocate an elements array.
364  STATIC_ASSERT(kSmiTag == 0);
365  __ Branch(call_generic_code, Ugreater_equal, a2,
367 
368  // a0: argc
369  // a1: constructor
370  // a2: array_size (smi)
371  // sp[0]: argument
372  AllocateJSArray(masm,
373  a1,
374  a2,
375  a3,
376  t0,
377  t1,
378  t2,
379  t3,
380  true,
381  call_generic_code);
382  __ IncrementCounter(counters->array_function_native(), 1, a2, t0);
383 
384  // Set up return value, remove receiver and argument from stack and return.
385  __ mov(v0, a3);
386  __ Addu(sp, sp, Operand(2 * kPointerSize));
387  __ Ret();
388 
389  // Handle construction of an array from a list of arguments.
390  __ bind(&argc_two_or_more);
391  __ sll(a2, a0, kSmiTagSize); // Convert argc to a smi.
392 
393  // a0: argc
394  // a1: constructor
395  // a2: array_size (smi)
396  // sp[0]: last argument
397  AllocateJSArray(masm,
398  a1,
399  a2,
400  a3,
401  t0,
402  t1,
403  t2,
404  t3,
405  false,
406  call_generic_code);
407  __ IncrementCounter(counters->array_function_native(), 1, a2, t2);
408 
409  // Fill arguments as array elements. Copy from the top of the stack (last
410  // element) to the array backing store filling it backwards. Note:
411  // elements_array_end points after the backing store.
412  // a0: argc
413  // a3: JSArray
414  // t0: elements_array storage start (untagged)
415  // t1: elements_array_end (untagged)
416  // sp[0]: last argument
417 
418  Label loop, entry;
419  __ Branch(USE_DELAY_SLOT, &entry);
420  __ mov(t3, sp);
421  __ bind(&loop);
422  __ lw(a2, MemOperand(t3));
423  if (FLAG_smi_only_arrays) {
424  __ JumpIfNotSmi(a2, &has_non_smi_element);
425  }
426  __ Addu(t3, t3, kPointerSize);
427  __ Addu(t1, t1, -kPointerSize);
428  __ sw(a2, MemOperand(t1));
429  __ bind(&entry);
430  __ Branch(&loop, lt, t0, Operand(t1));
431 
432  __ bind(&finish);
433  __ mov(sp, t3);
434 
435  // Remove caller arguments and receiver from the stack, setup return value and
436  // return.
437  // a0: argc
438  // a3: JSArray
439  // sp[0]: receiver
440  __ Addu(sp, sp, Operand(kPointerSize));
441  __ mov(v0, a3);
442  __ Ret();
443 
444  __ bind(&has_non_smi_element);
445  // Double values are handled by the runtime.
446  __ CheckMap(
447  a2, t5, Heap::kHeapNumberMapRootIndex, &not_double, DONT_DO_SMI_CHECK);
448  __ bind(&cant_transition_map);
449  __ UndoAllocationInNewSpace(a3, t0);
450  __ Branch(call_generic_code);
451 
452  __ bind(&not_double);
453  // Transition FAST_SMI_ELEMENTS to FAST_ELEMENTS.
454  // a3: JSArray
456  __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
458  a2,
459  t5,
460  &cant_transition_map);
462  __ RecordWriteField(a3,
464  a2,
465  t5,
470  Label loop2;
471  __ bind(&loop2);
472  __ lw(a2, MemOperand(t3));
473  __ Addu(t3, t3, kPointerSize);
474  __ Subu(t1, t1, kPointerSize);
475  __ sw(a2, MemOperand(t1));
476  __ Branch(&loop2, lt, t0, Operand(t1));
477  __ Branch(&finish);
478 }
479 
480 
481 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) {
482  // ----------- S t a t e -------------
483  // -- a0 : number of arguments
484  // -- ra : return address
485  // -- sp[...]: constructor arguments
486  // -----------------------------------
487  Label generic_array_code, one_or_more_arguments, two_or_more_arguments;
488 
489  // Get the InternalArray function.
490  GenerateLoadInternalArrayFunction(masm, a1);
491 
492  if (FLAG_debug_code) {
493  // Initial map for the builtin InternalArray functions should be maps.
495  __ And(t0, a2, Operand(kSmiTagMask));
496  __ Assert(ne, "Unexpected initial map for InternalArray function",
497  t0, Operand(zero_reg));
498  __ GetObjectType(a2, a3, t0);
499  __ Assert(eq, "Unexpected initial map for InternalArray function",
500  t0, Operand(MAP_TYPE));
501  }
502 
503  // Run the native code for the InternalArray function called as a normal
504  // function.
505  ArrayNativeCode(masm, &generic_array_code);
506 
507  // Jump to the generic array code if the specialized code cannot handle the
508  // construction.
509  __ bind(&generic_array_code);
510 
511  Handle<Code> array_code =
512  masm->isolate()->builtins()->InternalArrayCodeGeneric();
513  __ Jump(array_code, RelocInfo::CODE_TARGET);
514 }
515 
516 
517 void Builtins::Generate_ArrayCode(MacroAssembler* masm) {
518  // ----------- S t a t e -------------
519  // -- a0 : number of arguments
520  // -- ra : return address
521  // -- sp[...]: constructor arguments
522  // -----------------------------------
523  Label generic_array_code;
524 
525  // Get the Array function.
526  GenerateLoadArrayFunction(masm, a1);
527 
528  if (FLAG_debug_code) {
529  // Initial map for the builtin Array functions should be maps.
531  __ And(t0, a2, Operand(kSmiTagMask));
532  __ Assert(ne, "Unexpected initial map for Array function (1)",
533  t0, Operand(zero_reg));
534  __ GetObjectType(a2, a3, t0);
535  __ Assert(eq, "Unexpected initial map for Array function (2)",
536  t0, Operand(MAP_TYPE));
537  }
538 
539  // Run the native code for the Array function called as a normal function.
540  ArrayNativeCode(masm, &generic_array_code);
541 
542  // Jump to the generic array code if the specialized code cannot handle
543  // the construction.
544  __ bind(&generic_array_code);
545 
546  Handle<Code> array_code =
547  masm->isolate()->builtins()->ArrayCodeGeneric();
548  __ Jump(array_code, RelocInfo::CODE_TARGET);
549 }
550 
551 
552 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) {
553  // ----------- S t a t e -------------
554  // -- a0 : number of arguments
555  // -- a1 : constructor function
556  // -- ra : return address
557  // -- sp[...]: constructor arguments
558  // -----------------------------------
559  Label generic_constructor;
560 
561  if (FLAG_debug_code) {
562  // The array construct code is only set for the builtin and internal
563  // Array functions which always have a map.
564  // Initial map for the builtin Array function should be a map.
566  __ And(t0, a2, Operand(kSmiTagMask));
567  __ Assert(ne, "Unexpected initial map for Array function (3)",
568  t0, Operand(zero_reg));
569  __ GetObjectType(a2, a3, t0);
570  __ Assert(eq, "Unexpected initial map for Array function (4)",
571  t0, Operand(MAP_TYPE));
572  }
573 
574  // Run the native code for the Array function called as a constructor.
575  ArrayNativeCode(masm, &generic_constructor);
576 
577  // Jump to the generic construct code in case the specialized code cannot
578  // handle the construction.
579  __ bind(&generic_constructor);
580 
581  Handle<Code> generic_construct_stub =
582  masm->isolate()->builtins()->JSConstructStubGeneric();
583  __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
584 }
585 
586 
587 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
588  // ----------- S t a t e -------------
589  // -- a0 : number of arguments
590  // -- a1 : constructor function
591  // -- ra : return address
592  // -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
593  // -- sp[argc * 4] : receiver
594  // -----------------------------------
595  Counters* counters = masm->isolate()->counters();
596  __ IncrementCounter(counters->string_ctor_calls(), 1, a2, a3);
597 
598  Register function = a1;
599  if (FLAG_debug_code) {
600  __ LoadGlobalFunction(Context::STRING_FUNCTION_INDEX, a2);
601  __ Assert(eq, "Unexpected String function", function, Operand(a2));
602  }
603 
604  // Load the first arguments in a0 and get rid of the rest.
605  Label no_arguments;
606  __ Branch(&no_arguments, eq, a0, Operand(zero_reg));
607  // First args = sp[(argc - 1) * 4].
608  __ Subu(a0, a0, Operand(1));
609  __ sll(a0, a0, kPointerSizeLog2);
610  __ Addu(sp, a0, sp);
611  __ lw(a0, MemOperand(sp));
612  // sp now point to args[0], drop args[0] + receiver.
613  __ Drop(2);
614 
615  Register argument = a2;
616  Label not_cached, argument_is_string;
618  masm,
619  a0, // Input.
620  argument, // Result.
621  a3, // Scratch.
622  t0, // Scratch.
623  t1, // Scratch.
624  false, // Is it a Smi?
625  &not_cached);
626  __ IncrementCounter(counters->string_ctor_cached_number(), 1, a3, t0);
627  __ bind(&argument_is_string);
628 
629  // ----------- S t a t e -------------
630  // -- a2 : argument converted to string
631  // -- a1 : constructor function
632  // -- ra : return address
633  // -----------------------------------
634 
635  Label gc_required;
636  __ AllocateInNewSpace(JSValue::kSize,
637  v0, // Result.
638  a3, // Scratch.
639  t0, // Scratch.
640  &gc_required,
641  TAG_OBJECT);
642 
643  // Initialising the String Object.
644  Register map = a3;
645  __ LoadGlobalFunctionInitialMap(function, map, t0);
646  if (FLAG_debug_code) {
648  __ Assert(eq, "Unexpected string wrapper instance size",
649  t0, Operand(JSValue::kSize >> kPointerSizeLog2));
651  __ Assert(eq, "Unexpected unused properties of string wrapper",
652  t0, Operand(zero_reg));
653  }
655 
656  __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex);
659 
660  __ sw(argument, FieldMemOperand(v0, JSValue::kValueOffset));
661 
662  // Ensure the object is fully initialized.
664 
665  __ Ret();
666 
667  // The argument was not found in the number to string cache. Check
668  // if it's a string already before calling the conversion builtin.
669  Label convert_argument;
670  __ bind(&not_cached);
671  __ JumpIfSmi(a0, &convert_argument);
672 
673  // Is it a String?
677  __ And(t0, a3, Operand(kIsNotStringMask));
678  __ Branch(&convert_argument, ne, t0, Operand(zero_reg));
679  __ mov(argument, a0);
680  __ IncrementCounter(counters->string_ctor_conversions(), 1, a3, t0);
681  __ Branch(&argument_is_string);
682 
683  // Invoke the conversion builtin and put the result into a2.
684  __ bind(&convert_argument);
685  __ push(function); // Preserve the function.
686  __ IncrementCounter(counters->string_ctor_conversions(), 1, a3, t0);
687  {
688  FrameScope scope(masm, StackFrame::INTERNAL);
689  __ push(v0);
690  __ InvokeBuiltin(Builtins::TO_STRING, CALL_FUNCTION);
691  }
692  __ pop(function);
693  __ mov(argument, v0);
694  __ Branch(&argument_is_string);
695 
696  // Load the empty string into a2, remove the receiver from the
697  // stack, and jump back to the case where the argument is a string.
698  __ bind(&no_arguments);
699  __ LoadRoot(argument, Heap::kEmptyStringRootIndex);
700  __ Drop(1);
701  __ Branch(&argument_is_string);
702 
703  // At this point the argument is already a string. Call runtime to
704  // create a string wrapper.
705  __ bind(&gc_required);
706  __ IncrementCounter(counters->string_ctor_gc_required(), 1, a3, t0);
707  {
708  FrameScope scope(masm, StackFrame::INTERNAL);
709  __ push(argument);
710  __ CallRuntime(Runtime::kNewStringWrapper, 1);
711  }
712  __ Ret();
713 }
714 
715 
716 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
717  bool is_api_function,
718  bool count_constructions) {
719  // ----------- S t a t e -------------
720  // -- a0 : number of arguments
721  // -- a1 : constructor function
722  // -- ra : return address
723  // -- sp[...]: constructor arguments
724  // -----------------------------------
725 
726  // Should never count constructions for api objects.
727  ASSERT(!is_api_function || !count_constructions);
728 
729  Isolate* isolate = masm->isolate();
730 
731  // ----------- S t a t e -------------
732  // -- a0 : number of arguments
733  // -- a1 : constructor function
734  // -- ra : return address
735  // -- sp[...]: constructor arguments
736  // -----------------------------------
737 
738  // Enter a construct frame.
739  {
740  FrameScope scope(masm, StackFrame::CONSTRUCT);
741 
742  // Preserve the two incoming parameters on the stack.
743  __ sll(a0, a0, kSmiTagSize); // Tag arguments count.
744  __ MultiPushReversed(a0.bit() | a1.bit());
745 
746  // Use t7 to hold undefined, which is used in several places below.
747  __ LoadRoot(t7, Heap::kUndefinedValueRootIndex);
748 
749  Label rt_call, allocated;
750  // Try to allocate the object without transitioning into C code. If any of
751  // the preconditions is not met, the code bails out to the runtime call.
752  if (FLAG_inline_new) {
753  Label undo_allocation;
754 #ifdef ENABLE_DEBUGGER_SUPPORT
755  ExternalReference debug_step_in_fp =
756  ExternalReference::debug_step_in_fp_address(isolate);
757  __ li(a2, Operand(debug_step_in_fp));
758  __ lw(a2, MemOperand(a2));
759  __ Branch(&rt_call, ne, a2, Operand(zero_reg));
760 #endif
761 
762  // Load the initial map and verify that it is in fact a map.
763  // a1: constructor function
765  __ JumpIfSmi(a2, &rt_call);
766  __ GetObjectType(a2, a3, t4);
767  __ Branch(&rt_call, ne, t4, Operand(MAP_TYPE));
768 
769  // Check that the constructor is not constructing a JSFunction (see
770  // comments in Runtime_NewObject in runtime.cc). In which case the
771  // initial map's instance type would be JS_FUNCTION_TYPE.
772  // a1: constructor function
773  // a2: initial map
775  __ Branch(&rt_call, eq, a3, Operand(JS_FUNCTION_TYPE));
776 
777  if (count_constructions) {
778  Label allocate;
779  // Decrease generous allocation count.
781  MemOperand constructor_count =
783  __ lbu(t0, constructor_count);
784  __ Subu(t0, t0, Operand(1));
785  __ sb(t0, constructor_count);
786  __ Branch(&allocate, ne, t0, Operand(zero_reg));
787 
788  __ Push(a1, a2);
789 
790  __ push(a1); // Constructor.
791  // The call will replace the stub, so the countdown is only done once.
792  __ CallRuntime(Runtime::kFinalizeInstanceSize, 1);
793 
794  __ pop(a2);
795  __ pop(a1);
796 
797  __ bind(&allocate);
798  }
799 
800  // Now allocate the JSObject on the heap.
801  // a1: constructor function
802  // a2: initial map
804  __ AllocateInNewSpace(a3, t4, t5, t6, &rt_call, SIZE_IN_WORDS);
805 
806  // Allocated the JSObject, now initialize the fields. Map is set to
807  // initial map and properties and elements are set to empty fixed array.
808  // a1: constructor function
809  // a2: initial map
810  // a3: object size
811  // t4: JSObject (not tagged)
812  __ LoadRoot(t6, Heap::kEmptyFixedArrayRootIndex);
813  __ mov(t5, t4);
814  __ sw(a2, MemOperand(t5, JSObject::kMapOffset));
817  __ Addu(t5, t5, Operand(3*kPointerSize));
821 
822  // Fill all the in-object properties with appropriate filler.
823  // a1: constructor function
824  // a2: initial map
825  // a3: object size (in words)
826  // t4: JSObject (not tagged)
827  // t5: First in-object property of JSObject (not tagged)
828  __ sll(t0, a3, kPointerSizeLog2);
829  __ addu(t6, t4, t0); // End of object.
831  __ LoadRoot(t7, Heap::kUndefinedValueRootIndex);
832  if (count_constructions) {
835  kBitsPerByte);
836  __ sll(t0, a0, kPointerSizeLog2);
837  __ addu(a0, t5, t0);
838  // a0: offset of first field after pre-allocated fields
839  if (FLAG_debug_code) {
840  __ Assert(le, "Unexpected number of pre-allocated property fields.",
841  a0, Operand(t6));
842  }
843  __ InitializeFieldsWithFiller(t5, a0, t7);
844  // To allow for truncation.
845  __ LoadRoot(t7, Heap::kOnePointerFillerMapRootIndex);
846  }
847  __ InitializeFieldsWithFiller(t5, t6, t7);
848 
849  // Add the object tag to make the JSObject real, so that we can continue
850  // and jump into the continuation code at any time from now on. Any
851  // failures need to undo the allocation, so that the heap is in a
852  // consistent state and verifiable.
853  __ Addu(t4, t4, Operand(kHeapObjectTag));
854 
855  // Check if a non-empty properties array is needed. Continue with
856  // allocated object if not fall through to runtime call if it is.
857  // a1: constructor function
858  // t4: JSObject
859  // t5: start of next object (not tagged)
861  // The field instance sizes contains both pre-allocated property fields
862  // and in-object properties.
865  kBitsPerByte);
866  __ Addu(a3, a3, Operand(t6));
868  kBitsPerByte);
869  __ subu(a3, a3, t6);
870 
871  // Done if no extra properties are to be allocated.
872  __ Branch(&allocated, eq, a3, Operand(zero_reg));
873  __ Assert(greater_equal, "Property allocation count failed.",
874  a3, Operand(zero_reg));
875 
876  // Scale the number of elements by pointer size and add the header for
877  // FixedArrays to the start of the next object calculation from above.
878  // a1: constructor
879  // a3: number of elements in properties array
880  // t4: JSObject
881  // t5: start of next object
882  __ Addu(a0, a3, Operand(FixedArray::kHeaderSize / kPointerSize));
883  __ AllocateInNewSpace(
884  a0,
885  t5,
886  t6,
887  a2,
888  &undo_allocation,
889  static_cast<AllocationFlags>(RESULT_CONTAINS_TOP | SIZE_IN_WORDS));
890 
891  // Initialize the FixedArray.
892  // a1: constructor
893  // a3: number of elements in properties array (untagged)
894  // t4: JSObject
895  // t5: start of next object
896  __ LoadRoot(t6, Heap::kFixedArrayMapRootIndex);
897  __ mov(a2, t5);
898  __ sw(t6, MemOperand(a2, JSObject::kMapOffset));
899  __ sll(a0, a3, kSmiTagSize);
901  __ Addu(a2, a2, Operand(2 * kPointerSize));
902 
905 
906  // Initialize the fields to undefined.
907  // a1: constructor
908  // a2: First element of FixedArray (not tagged)
909  // a3: number of elements in properties array
910  // t4: JSObject
911  // t5: FixedArray (not tagged)
912  __ sll(t3, a3, kPointerSizeLog2);
913  __ addu(t6, a2, t3); // End of object.
915  { Label loop, entry;
916  if (count_constructions) {
917  __ LoadRoot(t7, Heap::kUndefinedValueRootIndex);
918  } else if (FLAG_debug_code) {
919  __ LoadRoot(t8, Heap::kUndefinedValueRootIndex);
920  __ Assert(eq, "Undefined value not loaded.", t7, Operand(t8));
921  }
922  __ jmp(&entry);
923  __ bind(&loop);
924  __ sw(t7, MemOperand(a2));
925  __ addiu(a2, a2, kPointerSize);
926  __ bind(&entry);
927  __ Branch(&loop, less, a2, Operand(t6));
928  }
929 
930  // Store the initialized FixedArray into the properties field of
931  // the JSObject.
932  // a1: constructor function
933  // t4: JSObject
934  // t5: FixedArray (not tagged)
935  __ Addu(t5, t5, Operand(kHeapObjectTag)); // Add the heap tag.
937 
938  // Continue with JSObject being successfully allocated.
939  // a1: constructor function
940  // a4: JSObject
941  __ jmp(&allocated);
942 
943  // Undo the setting of the new top so that the heap is verifiable. For
944  // example, the map's unused properties potentially do not match the
945  // allocated objects unused properties.
946  // t4: JSObject (previous new top)
947  __ bind(&undo_allocation);
948  __ UndoAllocationInNewSpace(t4, t5);
949  }
950 
951  __ bind(&rt_call);
952  // Allocate the new receiver object using the runtime call.
953  // a1: constructor function
954  __ push(a1); // Argument for Runtime_NewObject.
955  __ CallRuntime(Runtime::kNewObject, 1);
956  __ mov(t4, v0);
957 
958  // Receiver for constructor call allocated.
959  // t4: JSObject
960  __ bind(&allocated);
961  __ push(t4);
962  __ push(t4);
963 
964  // Reload the number of arguments from the stack.
965  // sp[0]: receiver
966  // sp[1]: receiver
967  // sp[2]: constructor function
968  // sp[3]: number of arguments (smi-tagged)
969  __ lw(a1, MemOperand(sp, 2 * kPointerSize));
970  __ lw(a3, MemOperand(sp, 3 * kPointerSize));
971 
972  // Set up pointer to last argument.
973  __ Addu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset));
974 
975  // Set up number of arguments for function call below.
976  __ srl(a0, a3, kSmiTagSize);
977 
978  // Copy arguments and receiver to the expression stack.
979  // a0: number of arguments
980  // a1: constructor function
981  // a2: address of last argument (caller sp)
982  // a3: number of arguments (smi-tagged)
983  // sp[0]: receiver
984  // sp[1]: receiver
985  // sp[2]: constructor function
986  // sp[3]: number of arguments (smi-tagged)
987  Label loop, entry;
988  __ jmp(&entry);
989  __ bind(&loop);
990  __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize);
991  __ Addu(t0, a2, Operand(t0));
992  __ lw(t1, MemOperand(t0));
993  __ push(t1);
994  __ bind(&entry);
995  __ Addu(a3, a3, Operand(-2));
996  __ Branch(&loop, greater_equal, a3, Operand(zero_reg));
997 
998  // Call the function.
999  // a0: number of arguments
1000  // a1: constructor function
1001  if (is_api_function) {
1003  Handle<Code> code =
1004  masm->isolate()->builtins()->HandleApiCallConstruct();
1005  ParameterCount expected(0);
1006  __ InvokeCode(code, expected, expected,
1007  RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD);
1008  } else {
1009  ParameterCount actual(a0);
1010  __ InvokeFunction(a1, actual, CALL_FUNCTION,
1011  NullCallWrapper(), CALL_AS_METHOD);
1012  }
1013 
1014  // Store offset of return address for deoptimizer.
1015  if (!is_api_function && !count_constructions) {
1016  masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset());
1017  }
1018 
1019  // Restore context from the frame.
1021 
1022  // If the result is an object (in the ECMA sense), we should get rid
1023  // of the receiver and use the result; see ECMA-262 section 13.2.2-7
1024  // on page 74.
1025  Label use_receiver, exit;
1026 
1027  // If the result is a smi, it is *not* an object in the ECMA sense.
1028  // v0: result
1029  // sp[0]: receiver (newly allocated object)
1030  // sp[1]: constructor function
1031  // sp[2]: number of arguments (smi-tagged)
1032  __ JumpIfSmi(v0, &use_receiver);
1033 
1034  // If the type of the result (stored in its map) is less than
1035  // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense.
1036  __ GetObjectType(v0, a3, a3);
1037  __ Branch(&exit, greater_equal, a3, Operand(FIRST_SPEC_OBJECT_TYPE));
1038 
1039  // Throw away the result of the constructor invocation and use the
1040  // on-stack receiver as the result.
1041  __ bind(&use_receiver);
1042  __ lw(v0, MemOperand(sp));
1043 
1044  // Remove receiver from the stack, remove caller arguments, and
1045  // return.
1046  __ bind(&exit);
1047  // v0: result
1048  // sp[0]: receiver (newly allocated object)
1049  // sp[1]: constructor function
1050  // sp[2]: number of arguments (smi-tagged)
1051  __ lw(a1, MemOperand(sp, 2 * kPointerSize));
1052 
1053  // Leave construct frame.
1054  }
1055 
1056  __ sll(t0, a1, kPointerSizeLog2 - 1);
1057  __ Addu(sp, sp, t0);
1058  __ Addu(sp, sp, kPointerSize);
1059  __ IncrementCounter(isolate->counters()->constructed_objects(), 1, a1, a2);
1060  __ Ret();
1061 }
1062 
1063 
1064 void Builtins::Generate_JSConstructStubCountdown(MacroAssembler* masm) {
1065  Generate_JSConstructStubHelper(masm, false, true);
1066 }
1067 
1068 
1069 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
1070  Generate_JSConstructStubHelper(masm, false, false);
1071 }
1072 
1073 
1074 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) {
1075  Generate_JSConstructStubHelper(masm, true, false);
1076 }
1077 
1078 
1079 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
1080  bool is_construct) {
1081  // Called from JSEntryStub::GenerateBody
1082 
1083  // ----------- S t a t e -------------
1084  // -- a0: code entry
1085  // -- a1: function
1086  // -- a2: receiver_pointer
1087  // -- a3: argc
1088  // -- s0: argv
1089  // -----------------------------------
1090 
1091  // Clear the context before we push it when entering the JS frame.
1092  __ mov(cp, zero_reg);
1093 
1094  // Enter an internal frame.
1095  {
1096  FrameScope scope(masm, StackFrame::INTERNAL);
1097 
1098  // Set up the context from the function argument.
1100 
1101  // Push the function and the receiver onto the stack.
1102  __ Push(a1, a2);
1103 
1104  // Copy arguments to the stack in a loop.
1105  // a3: argc
1106  // s0: argv, i.e. points to first arg
1107  Label loop, entry;
1108  __ sll(t0, a3, kPointerSizeLog2);
1109  __ addu(t2, s0, t0);
1110  __ b(&entry);
1111  __ nop(); // Branch delay slot nop.
1112  // t2 points past last arg.
1113  __ bind(&loop);
1114  __ lw(t0, MemOperand(s0)); // Read next parameter.
1115  __ addiu(s0, s0, kPointerSize);
1116  __ lw(t0, MemOperand(t0)); // Dereference handle.
1117  __ push(t0); // Push parameter.
1118  __ bind(&entry);
1119  __ Branch(&loop, ne, s0, Operand(t2));
1120 
1121  // Initialize all JavaScript callee-saved registers, since they will be seen
1122  // by the garbage collector as part of handlers.
1123  __ LoadRoot(t0, Heap::kUndefinedValueRootIndex);
1124  __ mov(s1, t0);
1125  __ mov(s2, t0);
1126  __ mov(s3, t0);
1127  __ mov(s4, t0);
1128  __ mov(s5, t0);
1129  // s6 holds the root address. Do not clobber.
1130  // s7 is cp. Do not init.
1131 
1132  // Invoke the code and pass argc as a0.
1133  __ mov(a0, a3);
1134  if (is_construct) {
1135  CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
1136  __ CallStub(&stub);
1137  } else {
1138  ParameterCount actual(a0);
1139  __ InvokeFunction(a1, actual, CALL_FUNCTION,
1140  NullCallWrapper(), CALL_AS_METHOD);
1141  }
1142 
1143  // Leave internal frame.
1144  }
1145 
1146  __ Jump(ra);
1147 }
1148 
1149 
1150 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) {
1151  Generate_JSEntryTrampolineHelper(masm, false);
1152 }
1153 
1154 
1155 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
1156  Generate_JSEntryTrampolineHelper(masm, true);
1157 }
1158 
1159 
1160 void Builtins::Generate_LazyCompile(MacroAssembler* masm) {
1161  // Enter an internal frame.
1162  {
1163  FrameScope scope(masm, StackFrame::INTERNAL);
1164 
1165  // Preserve the function.
1166  __ push(a1);
1167  // Push call kind information.
1168  __ push(t1);
1169 
1170  // Push the function on the stack as the argument to the runtime function.
1171  __ push(a1);
1172  // Call the runtime function.
1173  __ CallRuntime(Runtime::kLazyCompile, 1);
1174  // Calculate the entry point.
1175  __ addiu(t9, v0, Code::kHeaderSize - kHeapObjectTag);
1176 
1177  // Restore call kind information.
1178  __ pop(t1);
1179  // Restore saved function.
1180  __ pop(a1);
1181 
1182  // Tear down temporary frame.
1183  }
1184 
1185  // Do a tail-call of the compiled function.
1186  __ Jump(t9);
1187 }
1188 
1189 
1190 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) {
1191  // Enter an internal frame.
1192  {
1193  FrameScope scope(masm, StackFrame::INTERNAL);
1194 
1195  // Preserve the function.
1196  __ push(a1);
1197  // Push call kind information.
1198  __ push(t1);
1199 
1200  // Push the function on the stack as the argument to the runtime function.
1201  __ push(a1);
1202  __ CallRuntime(Runtime::kLazyRecompile, 1);
1203  // Calculate the entry point.
1204  __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
1205 
1206  // Restore call kind information.
1207  __ pop(t1);
1208  // Restore saved function.
1209  __ pop(a1);
1210 
1211  // Tear down temporary frame.
1212  }
1213 
1214  // Do a tail-call of the compiled function.
1215  __ Jump(t9);
1216 }
1217 
1218 
1219 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
1221  {
1222  FrameScope scope(masm, StackFrame::INTERNAL);
1223  // Pass the function and deoptimization type to the runtime system.
1224  __ li(a0, Operand(Smi::FromInt(static_cast<int>(type))));
1225  __ push(a0);
1226  __ CallRuntime(Runtime::kNotifyDeoptimized, 1);
1227  }
1228 
1229  // Get the full codegen state from the stack and untag it -> t2.
1230  __ lw(t2, MemOperand(sp, 0 * kPointerSize));
1231  __ SmiUntag(t2);
1232  // Switch on the state.
1233  Label with_tos_register, unknown_state;
1234  __ Branch(&with_tos_register,
1235  ne, t2, Operand(FullCodeGenerator::NO_REGISTERS));
1236  __ Addu(sp, sp, Operand(1 * kPointerSize)); // Remove state.
1237  __ Ret();
1238 
1239  __ bind(&with_tos_register);
1240  __ lw(v0, MemOperand(sp, 1 * kPointerSize));
1241  __ Branch(&unknown_state, ne, t2, Operand(FullCodeGenerator::TOS_REG));
1242 
1243  __ Addu(sp, sp, Operand(2 * kPointerSize)); // Remove state.
1244  __ Ret();
1245 
1246  __ bind(&unknown_state);
1247  __ stop("no cases left");
1248 }
1249 
1250 
1251 void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) {
1252  Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER);
1253 }
1254 
1255 
1256 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) {
1257  Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
1258 }
1259 
1260 
1261 void Builtins::Generate_NotifyOSR(MacroAssembler* masm) {
1262  // For now, we are relying on the fact that Runtime::NotifyOSR
1263  // doesn't do any garbage collection which allows us to save/restore
1264  // the registers without worrying about which of them contain
1265  // pointers. This seems a bit fragile.
1266  RegList saved_regs =
1267  (kJSCallerSaved | kCalleeSaved | ra.bit() | fp.bit()) & ~sp.bit();
1268  __ MultiPush(saved_regs);
1269  {
1270  FrameScope scope(masm, StackFrame::INTERNAL);
1271  __ CallRuntime(Runtime::kNotifyOSR, 0);
1272  }
1273  __ MultiPop(saved_regs);
1274  __ Ret();
1275 }
1276 
1277 
1278 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
1279  CpuFeatures::TryForceFeatureScope scope(VFP3);
1280  if (!CpuFeatures::IsSupported(FPU)) {
1281  __ Abort("Unreachable code: Cannot optimize without FPU support.");
1282  return;
1283  }
1284 
1285  // Lookup the function in the JavaScript frame and push it as an
1286  // argument to the on-stack replacement function.
1288  {
1289  FrameScope scope(masm, StackFrame::INTERNAL);
1290  __ push(a0);
1291  __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1);
1292  }
1293 
1294  // If the result was -1 it means that we couldn't optimize the
1295  // function. Just return and continue in the unoptimized version.
1296  __ Ret(eq, v0, Operand(Smi::FromInt(-1)));
1297 
1298  // Untag the AST id and push it on the stack.
1299  __ SmiUntag(v0);
1300  __ push(v0);
1301 
1302  // Generate the code for doing the frame-to-frame translation using
1303  // the deoptimizer infrastructure.
1304  Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1305  generator.Generate();
1306 }
1307 
1308 
1309 void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
1310  // 1. Make sure we have at least one argument.
1311  // a0: actual number of arguments
1312  { Label done;
1313  __ Branch(&done, ne, a0, Operand(zero_reg));
1314  __ LoadRoot(t2, Heap::kUndefinedValueRootIndex);
1315  __ push(t2);
1316  __ Addu(a0, a0, Operand(1));
1317  __ bind(&done);
1318  }
1319 
1320  // 2. Get the function to call (passed as receiver) from the stack, check
1321  // if it is a function.
1322  // a0: actual number of arguments
1323  Label slow, non_function;
1324  __ sll(at, a0, kPointerSizeLog2);
1325  __ addu(at, sp, at);
1326  __ lw(a1, MemOperand(at));
1327  __ JumpIfSmi(a1, &non_function);
1328  __ GetObjectType(a1, a2, a2);
1329  __ Branch(&slow, ne, a2, Operand(JS_FUNCTION_TYPE));
1330 
1331  // 3a. Patch the first argument if necessary when calling a function.
1332  // a0: actual number of arguments
1333  // a1: function
1334  Label shift_arguments;
1335  __ li(t0, Operand(0, RelocInfo::NONE)); // Indicate regular JS_FUNCTION.
1336  { Label convert_to_object, use_global_receiver, patch_receiver;
1337  // Change context eagerly in case we need the global receiver.
1339 
1340  // Do not transform the receiver for strict mode functions.
1343  __ And(t3, a3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
1344  kSmiTagSize)));
1345  __ Branch(&shift_arguments, ne, t3, Operand(zero_reg));
1346 
1347  // Do not transform the receiver for native (Compilerhints already in a3).
1348  __ And(t3, a3, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize)));
1349  __ Branch(&shift_arguments, ne, t3, Operand(zero_reg));
1350 
1351  // Compute the receiver in non-strict mode.
1352  // Load first argument in a2. a2 = -kPointerSize(sp + n_args << 2).
1353  __ sll(at, a0, kPointerSizeLog2);
1354  __ addu(a2, sp, at);
1355  __ lw(a2, MemOperand(a2, -kPointerSize));
1356  // a0: actual number of arguments
1357  // a1: function
1358  // a2: first argument
1359  __ JumpIfSmi(a2, &convert_to_object, t2);
1360 
1361  __ LoadRoot(a3, Heap::kUndefinedValueRootIndex);
1362  __ Branch(&use_global_receiver, eq, a2, Operand(a3));
1363  __ LoadRoot(a3, Heap::kNullValueRootIndex);
1364  __ Branch(&use_global_receiver, eq, a2, Operand(a3));
1365 
1367  __ GetObjectType(a2, a3, a3);
1368  __ Branch(&shift_arguments, ge, a3, Operand(FIRST_SPEC_OBJECT_TYPE));
1369 
1370  __ bind(&convert_to_object);
1371  // Enter an internal frame in order to preserve argument count.
1372  {
1373  FrameScope scope(masm, StackFrame::INTERNAL);
1374  __ sll(a0, a0, kSmiTagSize); // Smi tagged.
1375  __ push(a0);
1376 
1377  __ push(a2);
1378  __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
1379  __ mov(a2, v0);
1380 
1381  __ pop(a0);
1382  __ sra(a0, a0, kSmiTagSize); // Un-tag.
1383  // Leave internal frame.
1384  }
1385  // Restore the function to a1, and the flag to t0.
1386  __ sll(at, a0, kPointerSizeLog2);
1387  __ addu(at, sp, at);
1388  __ lw(a1, MemOperand(at));
1389  __ li(t0, Operand(0, RelocInfo::NONE));
1390  __ Branch(&patch_receiver);
1391 
1392  // Use the global receiver object from the called function as the
1393  // receiver.
1394  __ bind(&use_global_receiver);
1395  const int kGlobalIndex =
1397  __ lw(a2, FieldMemOperand(cp, kGlobalIndex));
1399  __ lw(a2, FieldMemOperand(a2, kGlobalIndex));
1401 
1402  __ bind(&patch_receiver);
1403  __ sll(at, a0, kPointerSizeLog2);
1404  __ addu(a3, sp, at);
1405  __ sw(a2, MemOperand(a3, -kPointerSize));
1406 
1407  __ Branch(&shift_arguments);
1408  }
1409 
1410  // 3b. Check for function proxy.
1411  __ bind(&slow);
1412  __ li(t0, Operand(1, RelocInfo::NONE)); // Indicate function proxy.
1413  __ Branch(&shift_arguments, eq, a2, Operand(JS_FUNCTION_PROXY_TYPE));
1414 
1415  __ bind(&non_function);
1416  __ li(t0, Operand(2, RelocInfo::NONE)); // Indicate non-function.
1417 
1418  // 3c. Patch the first argument when calling a non-function. The
1419  // CALL_NON_FUNCTION builtin expects the non-function callee as
1420  // receiver, so overwrite the first argument which will ultimately
1421  // become the receiver.
1422  // a0: actual number of arguments
1423  // a1: function
1424  // t0: call type (0: JS function, 1: function proxy, 2: non-function)
1425  __ sll(at, a0, kPointerSizeLog2);
1426  __ addu(a2, sp, at);
1427  __ sw(a1, MemOperand(a2, -kPointerSize));
1428 
1429  // 4. Shift arguments and return address one slot down on the stack
1430  // (overwriting the original receiver). Adjust argument count to make
1431  // the original first argument the new receiver.
1432  // a0: actual number of arguments
1433  // a1: function
1434  // t0: call type (0: JS function, 1: function proxy, 2: non-function)
1435  __ bind(&shift_arguments);
1436  { Label loop;
1437  // Calculate the copy start address (destination). Copy end address is sp.
1438  __ sll(at, a0, kPointerSizeLog2);
1439  __ addu(a2, sp, at);
1440 
1441  __ bind(&loop);
1442  __ lw(at, MemOperand(a2, -kPointerSize));
1443  __ sw(at, MemOperand(a2));
1444  __ Subu(a2, a2, Operand(kPointerSize));
1445  __ Branch(&loop, ne, a2, Operand(sp));
1446  // Adjust the actual number of arguments and remove the top element
1447  // (which is a copy of the last argument).
1448  __ Subu(a0, a0, Operand(1));
1449  __ Pop();
1450  }
1451 
1452  // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin,
1453  // or a function proxy via CALL_FUNCTION_PROXY.
1454  // a0: actual number of arguments
1455  // a1: function
1456  // t0: call type (0: JS function, 1: function proxy, 2: non-function)
1457  { Label function, non_proxy;
1458  __ Branch(&function, eq, t0, Operand(zero_reg));
1459  // Expected number of arguments is 0 for CALL_NON_FUNCTION.
1460  __ mov(a2, zero_reg);
1461  __ SetCallKind(t1, CALL_AS_METHOD);
1462  __ Branch(&non_proxy, ne, t0, Operand(1));
1463 
1464  __ push(a1); // Re-add proxy object as additional argument.
1465  __ Addu(a0, a0, Operand(1));
1466  __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY);
1467  __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1468  RelocInfo::CODE_TARGET);
1469 
1470  __ bind(&non_proxy);
1471  __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION);
1472  __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1473  RelocInfo::CODE_TARGET);
1474  __ bind(&function);
1475  }
1476 
1477  // 5b. Get the code to call from the function and check that the number of
1478  // expected arguments matches what we're providing. If so, jump
1479  // (tail-call) to the code in register edx without checking arguments.
1480  // a0: actual number of arguments
1481  // a1: function
1483  __ lw(a2,
1485  __ sra(a2, a2, kSmiTagSize);
1487  __ SetCallKind(t1, CALL_AS_METHOD);
1488  // Check formal and actual parameter counts.
1489  __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1490  RelocInfo::CODE_TARGET, ne, a2, Operand(a0));
1491 
1492  ParameterCount expected(0);
1493  __ InvokeCode(a3, expected, expected, JUMP_FUNCTION,
1494  NullCallWrapper(), CALL_AS_METHOD);
1495 }
1496 
1497 
1498 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1499  const int kIndexOffset = -5 * kPointerSize;
1500  const int kLimitOffset = -4 * kPointerSize;
1501  const int kArgsOffset = 2 * kPointerSize;
1502  const int kRecvOffset = 3 * kPointerSize;
1503  const int kFunctionOffset = 4 * kPointerSize;
1504 
1505  {
1506  FrameScope frame_scope(masm, StackFrame::INTERNAL);
1507  __ lw(a0, MemOperand(fp, kFunctionOffset)); // Get the function.
1508  __ push(a0);
1509  __ lw(a0, MemOperand(fp, kArgsOffset)); // Get the args array.
1510  __ push(a0);
1511  // Returns (in v0) number of arguments to copy to stack as Smi.
1512  __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION);
1513 
1514  // Check the stack for overflow. We are not trying to catch
1515  // interruptions (e.g. debug break and preemption) here, so the "real stack
1516  // limit" is checked.
1517  Label okay;
1518  __ LoadRoot(a2, Heap::kRealStackLimitRootIndex);
1519  // Make a2 the space we have left. The stack might already be overflowed
1520  // here which will cause a2 to become negative.
1521  __ subu(a2, sp, a2);
1522  // Check if the arguments will overflow the stack.
1523  __ sll(t3, v0, kPointerSizeLog2 - kSmiTagSize);
1524  __ Branch(&okay, gt, a2, Operand(t3)); // Signed comparison.
1525 
1526  // Out of stack space.
1527  __ lw(a1, MemOperand(fp, kFunctionOffset));
1528  __ push(a1);
1529  __ push(v0);
1530  __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION);
1531  // End of stack check.
1532 
1533  // Push current limit and index.
1534  __ bind(&okay);
1535  __ push(v0); // Limit.
1536  __ mov(a1, zero_reg); // Initial index.
1537  __ push(a1);
1538 
1539  // Get the receiver.
1540  __ lw(a0, MemOperand(fp, kRecvOffset));
1541 
1542  // Check that the function is a JS function (otherwise it must be a proxy).
1543  Label push_receiver;
1544  __ lw(a1, MemOperand(fp, kFunctionOffset));
1545  __ GetObjectType(a1, a2, a2);
1546  __ Branch(&push_receiver, ne, a2, Operand(JS_FUNCTION_TYPE));
1547 
1548  // Change context eagerly to get the right global object if necessary.
1550  // Load the shared function info while the function is still in a1.
1552 
1553  // Compute the receiver.
1554  // Do not transform the receiver for strict mode functions.
1555  Label call_to_object, use_global_receiver;
1557  __ And(t3, a2, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
1558  kSmiTagSize)));
1559  __ Branch(&push_receiver, ne, t3, Operand(zero_reg));
1560 
1561  // Do not transform the receiver for native (Compilerhints already in a2).
1562  __ And(t3, a2, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize)));
1563  __ Branch(&push_receiver, ne, t3, Operand(zero_reg));
1564 
1565  // Compute the receiver in non-strict mode.
1566  __ JumpIfSmi(a0, &call_to_object);
1567  __ LoadRoot(a1, Heap::kNullValueRootIndex);
1568  __ Branch(&use_global_receiver, eq, a0, Operand(a1));
1569  __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
1570  __ Branch(&use_global_receiver, eq, a0, Operand(a2));
1571 
1572  // Check if the receiver is already a JavaScript object.
1573  // a0: receiver
1575  __ GetObjectType(a0, a1, a1);
1576  __ Branch(&push_receiver, ge, a1, Operand(FIRST_SPEC_OBJECT_TYPE));
1577 
1578  // Convert the receiver to a regular object.
1579  // a0: receiver
1580  __ bind(&call_to_object);
1581  __ push(a0);
1582  __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
1583  __ mov(a0, v0); // Put object in a0 to match other paths to push_receiver.
1584  __ Branch(&push_receiver);
1585 
1586  // Use the current global receiver object as the receiver.
1587  __ bind(&use_global_receiver);
1588  const int kGlobalOffset =
1590  __ lw(a0, FieldMemOperand(cp, kGlobalOffset));
1592  __ lw(a0, FieldMemOperand(a0, kGlobalOffset));
1594 
1595  // Push the receiver.
1596  // a0: receiver
1597  __ bind(&push_receiver);
1598  __ push(a0);
1599 
1600  // Copy all arguments from the array to the stack.
1601  Label entry, loop;
1602  __ lw(a0, MemOperand(fp, kIndexOffset));
1603  __ Branch(&entry);
1604 
1605  // Load the current argument from the arguments array and push it to the
1606  // stack.
1607  // a0: current argument index
1608  __ bind(&loop);
1609  __ lw(a1, MemOperand(fp, kArgsOffset));
1610  __ push(a1);
1611  __ push(a0);
1612 
1613  // Call the runtime to access the property in the arguments array.
1614  __ CallRuntime(Runtime::kGetProperty, 2);
1615  __ push(v0);
1616 
1617  // Use inline caching to access the arguments.
1618  __ lw(a0, MemOperand(fp, kIndexOffset));
1619  __ Addu(a0, a0, Operand(1 << kSmiTagSize));
1620  __ sw(a0, MemOperand(fp, kIndexOffset));
1621 
1622  // Test if the copy loop has finished copying all the elements from the
1623  // arguments object.
1624  __ bind(&entry);
1625  __ lw(a1, MemOperand(fp, kLimitOffset));
1626  __ Branch(&loop, ne, a0, Operand(a1));
1627 
1628  // Invoke the function.
1629  Label call_proxy;
1630  ParameterCount actual(a0);
1631  __ sra(a0, a0, kSmiTagSize);
1632  __ lw(a1, MemOperand(fp, kFunctionOffset));
1633  __ GetObjectType(a1, a2, a2);
1634  __ Branch(&call_proxy, ne, a2, Operand(JS_FUNCTION_TYPE));
1635 
1636  __ InvokeFunction(a1, actual, CALL_FUNCTION,
1637  NullCallWrapper(), CALL_AS_METHOD);
1638 
1639  frame_scope.GenerateLeaveFrame();
1640  __ Ret(USE_DELAY_SLOT);
1641  __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot.
1642 
1643  // Invoke the function proxy.
1644  __ bind(&call_proxy);
1645  __ push(a1); // Add function proxy as last argument.
1646  __ Addu(a0, a0, Operand(1));
1647  __ li(a2, Operand(0, RelocInfo::NONE));
1648  __ SetCallKind(t1, CALL_AS_METHOD);
1649  __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY);
1650  __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1651  RelocInfo::CODE_TARGET);
1652  // Tear down the internal frame and remove function, receiver and args.
1653  }
1654 
1655  __ Ret(USE_DELAY_SLOT);
1656  __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot.
1657 }
1658 
1659 
1660 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
1661  __ sll(a0, a0, kSmiTagSize);
1662  __ li(t0, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
1663  __ MultiPush(a0.bit() | a1.bit() | t0.bit() | fp.bit() | ra.bit());
1664  __ Addu(fp, sp, Operand(3 * kPointerSize));
1665 }
1666 
1667 
1668 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) {
1669  // ----------- S t a t e -------------
1670  // -- v0 : result being passed through
1671  // -----------------------------------
1672  // Get the number of arguments passed (as a smi), tear down the frame and
1673  // then tear down the parameters.
1674  __ lw(a1, MemOperand(fp, -3 * kPointerSize));
1675  __ mov(sp, fp);
1676  __ MultiPop(fp.bit() | ra.bit());
1677  __ sll(t0, a1, kPointerSizeLog2 - kSmiTagSize);
1678  __ Addu(sp, sp, t0);
1679  // Adjust for the receiver.
1680  __ Addu(sp, sp, Operand(kPointerSize));
1681 }
1682 
1683 
1684 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
1685  // State setup as expected by MacroAssembler::InvokePrologue.
1686  // ----------- S t a t e -------------
1687  // -- a0: actual arguments count
1688  // -- a1: function (passed through to callee)
1689  // -- a2: expected arguments count
1690  // -- a3: callee code entry
1691  // -- t1: call kind information
1692  // -----------------------------------
1693 
1694  Label invoke, dont_adapt_arguments;
1695 
1696  Label enough, too_few;
1697  __ Branch(&dont_adapt_arguments, eq,
1699  // We use Uless as the number of argument should always be greater than 0.
1700  __ Branch(&too_few, Uless, a0, Operand(a2));
1701 
1702  { // Enough parameters: actual >= expected.
1703  // a0: actual number of arguments as a smi
1704  // a1: function
1705  // a2: expected number of arguments
1706  // a3: code entry to call
1707  __ bind(&enough);
1708  EnterArgumentsAdaptorFrame(masm);
1709 
1710  // Calculate copy start address into a0 and copy end address into a2.
1711  __ sll(a0, a0, kPointerSizeLog2 - kSmiTagSize);
1712  __ Addu(a0, fp, a0);
1713  // Adjust for return address and receiver.
1714  __ Addu(a0, a0, Operand(2 * kPointerSize));
1715  // Compute copy end address.
1716  __ sll(a2, a2, kPointerSizeLog2);
1717  __ subu(a2, a0, a2);
1718 
1719  // Copy the arguments (including the receiver) to the new stack frame.
1720  // a0: copy start address
1721  // a1: function
1722  // a2: copy end address
1723  // a3: code entry to call
1724 
1725  Label copy;
1726  __ bind(&copy);
1727  __ lw(t0, MemOperand(a0));
1728  __ push(t0);
1729  __ Branch(USE_DELAY_SLOT, &copy, ne, a0, Operand(a2));
1730  __ addiu(a0, a0, -kPointerSize); // In delay slot.
1731 
1732  __ jmp(&invoke);
1733  }
1734 
1735  { // Too few parameters: Actual < expected.
1736  __ bind(&too_few);
1737  EnterArgumentsAdaptorFrame(masm);
1738 
1739  // Calculate copy start address into a0 and copy end address is fp.
1740  // a0: actual number of arguments as a smi
1741  // a1: function
1742  // a2: expected number of arguments
1743  // a3: code entry to call
1744  __ sll(a0, a0, kPointerSizeLog2 - kSmiTagSize);
1745  __ Addu(a0, fp, a0);
1746  // Adjust for return address and receiver.
1747  __ Addu(a0, a0, Operand(2 * kPointerSize));
1748  // Compute copy end address. Also adjust for return address.
1749  __ Addu(t3, fp, kPointerSize);
1750 
1751  // Copy the arguments (including the receiver) to the new stack frame.
1752  // a0: copy start address
1753  // a1: function
1754  // a2: expected number of arguments
1755  // a3: code entry to call
1756  // t3: copy end address
1757  Label copy;
1758  __ bind(&copy);
1759  __ lw(t0, MemOperand(a0)); // Adjusted above for return addr and receiver.
1760  __ Subu(sp, sp, kPointerSize);
1761  __ Subu(a0, a0, kPointerSize);
1762  __ Branch(USE_DELAY_SLOT, &copy, ne, a0, Operand(t3));
1763  __ sw(t0, MemOperand(sp)); // In the delay slot.
1764 
1765  // Fill the remaining expected arguments with undefined.
1766  // a1: function
1767  // a2: expected number of arguments
1768  // a3: code entry to call
1769  __ LoadRoot(t0, Heap::kUndefinedValueRootIndex);
1770  __ sll(t2, a2, kPointerSizeLog2);
1771  __ Subu(a2, fp, Operand(t2));
1772  __ Addu(a2, a2, Operand(-4 * kPointerSize)); // Adjust for frame.
1773 
1774  Label fill;
1775  __ bind(&fill);
1776  __ Subu(sp, sp, kPointerSize);
1777  __ Branch(USE_DELAY_SLOT, &fill, ne, sp, Operand(a2));
1778  __ sw(t0, MemOperand(sp));
1779  }
1780 
1781  // Call the entry point.
1782  __ bind(&invoke);
1783 
1784  __ Call(a3);
1785 
1786  // Store offset of return address for deoptimizer.
1787  masm->isolate()->heap()->SetArgumentsAdaptorDeoptPCOffset(masm->pc_offset());
1788 
1789  // Exit frame and return.
1790  LeaveArgumentsAdaptorFrame(masm);
1791  __ Ret();
1792 
1793 
1794  // -------------------------------------------
1795  // Don't adapt arguments.
1796  // -------------------------------------------
1797  __ bind(&dont_adapt_arguments);
1798  __ Jump(a3);
1799 }
1800 
1801 
1802 #undef __
1803 
1804 } } // namespace v8::internal
1805 
1806 #endif // V8_TARGET_ARCH_MIPS
const Register cp
const SwVfpRegister s2
const intptr_t kSmiTagMask
Definition: v8.h:3855
static const int kCodeEntryOffset
Definition: objects.h:5981
static const int kPrototypeOrInitialMapOffset
Definition: objects.h:5982
static int SlotOffset(int index)
Definition: contexts.h:408
static Smi * FromInt(int value)
Definition: objects-inl.h:973
const intptr_t kIntptrSignBit
Definition: globals.h:247
static const int kGlobalReceiverOffset
Definition: objects.h:6085
static const int kConstructionCountOffset
Definition: objects.h:5697
uint32_t RegList
Definition: frames.h:38
static bool IsSupported(CpuFeature f)
#define ASSERT(condition)
Definition: checks.h:270
const RegList kJSCallerSaved
Definition: frames-arm.h:47
const int kPointerSizeLog2
Definition: globals.h:246
static const int kInstanceSizeOffset
Definition: objects.h:4981
static const int kUnusedPropertyFieldsOffset
Definition: objects.h:4993
static const int kInstanceSizesOffset
Definition: objects.h:4951
static const int kGlobalContextOffset
Definition: objects.h:6084
static const int kContextOffset
Definition: objects.h:5986
const intptr_t kHeapObjectTagMask
Definition: v8.h:3850
static const int kSize
Definition: objects.h:8112
static const int kInObjectPropertiesByte
Definition: objects.h:4982
const uint32_t kNotStringTag
Definition: objects.h:438
const Register sp
const SwVfpRegister s3
STATIC_ASSERT((FixedDoubleArray::kHeaderSize &kDoubleAlignmentMask)==0)
BuiltinExtraArguments
Definition: builtins.h:35
static const int kDontAdaptArgumentsSentinel
Definition: objects.h:5601
const int kPointerSize
Definition: globals.h:234
const int kHeapObjectTag
Definition: v8.h:3848
const RegList kCalleeSaved
Definition: frames-arm.h:63
#define __
static const int kPropertiesOffset
Definition: objects.h:2113
const SwVfpRegister s0
const int kBitsPerByte
Definition: globals.h:251
static const int kElementsOffset
Definition: objects.h:2114
const SwVfpRegister s5
static const int kLengthOffset
Definition: objects.h:8111
static int SizeFor(int length)
Definition: objects.h:2288
const SwVfpRegister s1
static const int kHeaderSize
Definition: objects.h:2233
static const int kSize
Definition: objects.h:6189
static const int kMapOffset
Definition: objects.h:1219
const uint32_t kIsNotStringMask
Definition: objects.h:436
static const int kLengthOffset
Definition: objects.h:2232
MemOperand FieldMemOperand(Register object, int offset)
static const int kFormalParameterCountOffset
Definition: objects.h:5662
const int kSmiTagSize
Definition: v8.h:3854
static const int kHeaderSize
Definition: objects.h:4513
#define ASSERT_EQ(v1, v2)
Definition: checks.h:271
const SwVfpRegister s4
const int kSmiTag
Definition: v8.h:3853
static const int kHeaderSize
Definition: objects.h:2115
static void GenerateLookupNumberStringCache(MacroAssembler *masm, Register object, Register result, Register scratch1, Register scratch2, Register scratch3, bool object_is_smi, Label *not_found)
static const int kPreAllocatedPropertyFieldsByte
Definition: objects.h:4985
static const int kPreallocatedArrayElements
Definition: objects.h:8108
static const int kValueOffset
Definition: objects.h:6188
const Register fp
static const int kCompilerHintsOffset
Definition: objects.h:5677
static const int kSharedFunctionInfoOffset
Definition: objects.h:5984
static const int kInitialMaxFastElementArray
Definition: objects.h:2103
FlagType type() const
Definition: flags.cc:1358
static const int kInstanceTypeOffset
Definition: objects.h:4992