Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: src/mips/builtins-mips.cc

Issue 1440193003: [builtins] One runtime fallback is enough for the String constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use correct temp registers. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 FrameScope scope(masm, StackFrame::INTERNAL); 260 FrameScope scope(masm, StackFrame::INTERNAL);
261 ToStringStub stub(masm->isolate()); 261 ToStringStub stub(masm->isolate());
262 __ Push(a1, a3); 262 __ Push(a1, a3);
263 __ CallStub(&stub); 263 __ CallStub(&stub);
264 __ Move(a0, v0); 264 __ Move(a0, v0);
265 __ Pop(a1, a3); 265 __ Pop(a1, a3);
266 } 266 }
267 __ bind(&done_convert); 267 __ bind(&done_convert);
268 } 268 }
269 269
270 // 3. Allocate a JSValue wrapper for the string. 270 // 3. Check if original constructor and constructor differ.
271 Label new_object;
272 __ Branch(&new_object, ne, a1, Operand(a3));
273
274 // 4. Allocate a JSValue wrapper for the string.
271 { 275 {
272 // ----------- S t a t e ------------- 276 // ----------- S t a t e -------------
273 // -- a0 : the first argument 277 // -- a0 : the first argument
274 // -- a1 : constructor function 278 // -- a1 : constructor function
275 // -- a3 : original constructor 279 // -- a3 : original constructor
276 // -- ra : return address 280 // -- ra : return address
277 // ----------------------------------- 281 // -----------------------------------
278 282 __ Allocate(JSValue::kSize, v0, a2, t0, &new_object, TAG_OBJECT);
279 Label allocate, done_allocate, rt_call;
280
281 // Fall back to runtime if the original constructor and function differ.
282 __ Branch(&rt_call, ne, a1, Operand(a3));
283
284 __ Allocate(JSValue::kSize, v0, a2, a3, &allocate, TAG_OBJECT);
285 __ bind(&done_allocate);
286 283
287 // Initialize the JSValue in eax. 284 // Initialize the JSValue in eax.
288 __ LoadGlobalFunctionInitialMap(a1, a2, a3); 285 __ LoadGlobalFunctionInitialMap(a1, a2, a3);
289 __ sw(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); 286 __ sw(a2, FieldMemOperand(v0, HeapObject::kMapOffset));
290 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); 287 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex);
291 __ sw(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset)); 288 __ sw(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset));
292 __ sw(a3, FieldMemOperand(v0, JSObject::kElementsOffset)); 289 __ sw(a3, FieldMemOperand(v0, JSObject::kElementsOffset));
293 __ Ret(USE_DELAY_SLOT); 290 __ Ret(USE_DELAY_SLOT);
294 __ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset)); 291 __ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset));
295 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); 292 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize);
293 }
296 294
297 // Fallback to the runtime to allocate in new space. 295 // 5. Fallback to the runtime to create new object.
298 __ bind(&allocate); 296 __ bind(&new_object);
299 { 297 {
300 FrameScope scope(masm, StackFrame::INTERNAL); 298 FrameScope scope(masm, StackFrame::INTERNAL);
301 __ Move(a2, Smi::FromInt(JSValue::kSize)); 299 __ Push(a0, a1, a3); // first argument, constructor, original constructor
302 __ Push(a0, a1, a2); 300 __ CallRuntime(Runtime::kNewObject, 2);
303 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); 301 __ Pop(a0);
304 __ Pop(a0, a1);
305 }
306 __ jmp(&done_allocate);
307
308 // Fallback to the runtime to create new object.
309 __ bind(&rt_call);
310 {
311 FrameScope scope(masm, StackFrame::INTERNAL);
312 __ Push(a0, a1, a1, a3); // constructor function, original constructor
313 __ CallRuntime(Runtime::kNewObject, 2);
314 __ Pop(a0, a1);
315 }
316 __ Ret(USE_DELAY_SLOT);
317 __ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset));
318 } 302 }
303 __ Ret(USE_DELAY_SLOT);
304 __ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset));
319 } 305 }
320 306
321 307
322 static void CallRuntimePassFunction( 308 static void CallRuntimePassFunction(
323 MacroAssembler* masm, Runtime::FunctionId function_id) { 309 MacroAssembler* masm, Runtime::FunctionId function_id) {
324 FrameScope scope(masm, StackFrame::INTERNAL); 310 FrameScope scope(masm, StackFrame::INTERNAL);
325 // Push a copy of the function onto the stack. 311 // Push a copy of the function onto the stack.
326 // Push call kind information and function as parameter to the runtime call. 312 // Push call kind information and function as parameter to the runtime call.
327 __ Push(a1, a1); 313 __ Push(a1, a1);
328 314
(...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 } 1954 }
1969 } 1955 }
1970 1956
1971 1957
1972 #undef __ 1958 #undef __
1973 1959
1974 } // namespace internal 1960 } // namespace internal
1975 } // namespace v8 1961 } // namespace v8
1976 1962
1977 #endif // V8_TARGET_ARCH_MIPS 1963 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698