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

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

Issue 1413033006: Reland "[es6] Better support for built-ins subclassing." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: We don't need TypedArray map smashing anymore 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/builtins-ia32.cc ('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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); 220 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1);
221 } 221 }
222 } 222 }
223 223
224 224
225 // static 225 // static
226 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { 226 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
227 // ----------- S t a t e ------------- 227 // ----------- S t a t e -------------
228 // -- a0 : number of arguments 228 // -- a0 : number of arguments
229 // -- a1 : constructor function 229 // -- a1 : constructor function
230 // -- a3 : original constructor
230 // -- ra : return address 231 // -- ra : return address
231 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) 232 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
232 // -- sp[argc * 4] : receiver 233 // -- sp[argc * 4] : receiver
233 // ----------------------------------- 234 // -----------------------------------
234 235
235 // 1. Load the first argument into a0 and get rid of the rest (including the 236 // 1. Load the first argument into a0 and get rid of the rest (including the
236 // receiver). 237 // receiver).
237 { 238 {
238 Label no_arguments, done; 239 Label no_arguments, done;
239 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); 240 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg));
(...skipping 13 matching lines...) Expand all
253 { 254 {
254 Label convert, done_convert; 255 Label convert, done_convert;
255 __ JumpIfSmi(a0, &convert); 256 __ JumpIfSmi(a0, &convert);
256 __ GetObjectType(a0, a2, a2); 257 __ GetObjectType(a0, a2, a2);
257 __ And(t0, a2, Operand(kIsNotStringMask)); 258 __ And(t0, a2, Operand(kIsNotStringMask));
258 __ Branch(&done_convert, eq, t0, Operand(zero_reg)); 259 __ Branch(&done_convert, eq, t0, Operand(zero_reg));
259 __ bind(&convert); 260 __ bind(&convert);
260 { 261 {
261 FrameScope scope(masm, StackFrame::INTERNAL); 262 FrameScope scope(masm, StackFrame::INTERNAL);
262 ToStringStub stub(masm->isolate()); 263 ToStringStub stub(masm->isolate());
263 __ Push(a1); 264 __ Push(a1, a3);
264 __ CallStub(&stub); 265 __ CallStub(&stub);
265 __ Move(a0, v0); 266 __ Move(a0, v0);
266 __ Pop(a1); 267 __ Pop(a1, a3);
267 } 268 }
268 __ bind(&done_convert); 269 __ bind(&done_convert);
269 } 270 }
270 271
271 // 3. Allocate a JSValue wrapper for the string. 272 // 3. Allocate a JSValue wrapper for the string.
272 { 273 {
273 // ----------- S t a t e ------------- 274 // ----------- S t a t e -------------
274 // -- a0 : the first argument 275 // -- a0 : the first argument
275 // -- a1 : constructor function 276 // -- a1 : constructor function
277 // -- a3 : original constructor
276 // -- ra : return address 278 // -- ra : return address
277 // ----------------------------------- 279 // -----------------------------------
278 280
279 Label allocate, done_allocate; 281 Label allocate, done_allocate, rt_call;
282
283 // Fall back to runtime if the original constructor and function differ.
284 __ Branch(&rt_call, ne, a1, Operand(a3));
285
280 __ Allocate(JSValue::kSize, v0, a2, a3, &allocate, TAG_OBJECT); 286 __ Allocate(JSValue::kSize, v0, a2, a3, &allocate, TAG_OBJECT);
281 __ bind(&done_allocate); 287 __ bind(&done_allocate);
282 288
283 // Initialize the JSValue in eax. 289 // Initialize the JSValue in eax.
284 __ LoadGlobalFunctionInitialMap(a1, a2, a3); 290 __ LoadGlobalFunctionInitialMap(a1, a2, a3);
285 __ sw(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); 291 __ sw(a2, FieldMemOperand(v0, HeapObject::kMapOffset));
286 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); 292 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex);
287 __ sw(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset)); 293 __ sw(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset));
288 __ sw(a3, FieldMemOperand(v0, JSObject::kElementsOffset)); 294 __ sw(a3, FieldMemOperand(v0, JSObject::kElementsOffset));
289 __ Ret(USE_DELAY_SLOT); 295 __ Ret(USE_DELAY_SLOT);
290 __ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset)); 296 __ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset));
291 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); 297 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize);
292 298
293 // Fallback to the runtime to allocate in new space. 299 // Fallback to the runtime to allocate in new space.
294 __ bind(&allocate); 300 __ bind(&allocate);
295 { 301 {
296 FrameScope scope(masm, StackFrame::INTERNAL); 302 FrameScope scope(masm, StackFrame::INTERNAL);
297 __ Move(a2, Smi::FromInt(JSValue::kSize)); 303 __ Move(a2, Smi::FromInt(JSValue::kSize));
298 __ Push(a0, a1, a2); 304 __ Push(a0, a1, a2);
299 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); 305 __ CallRuntime(Runtime::kAllocateInNewSpace, 1);
300 __ Pop(a0, a1); 306 __ Pop(a0, a1);
301 } 307 }
302 __ jmp(&done_allocate); 308 __ jmp(&done_allocate);
309
310 // Fallback to the runtime to create new object.
311 __ bind(&rt_call);
312 {
313 FrameScope scope(masm, StackFrame::INTERNAL);
314 __ Push(a0, a1, a1, a3); // constructor function, original constructor
315 __ CallRuntime(Runtime::kNewObject, 2);
316 __ Pop(a0, a1);
317 }
318 __ Ret(USE_DELAY_SLOT);
319 __ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset));
303 } 320 }
304 } 321 }
305 322
306 323
307 static void CallRuntimePassFunction( 324 static void CallRuntimePassFunction(
308 MacroAssembler* masm, Runtime::FunctionId function_id) { 325 MacroAssembler* masm, Runtime::FunctionId function_id) {
309 FrameScope scope(masm, StackFrame::INTERNAL); 326 FrameScope scope(masm, StackFrame::INTERNAL);
310 // Push a copy of the function onto the stack. 327 // Push a copy of the function onto the stack.
311 // Push call kind information and function as parameter to the runtime call. 328 // Push call kind information and function as parameter to the runtime call.
312 __ Push(a1, a1); 329 __ Push(a1, a1);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // Reload the original constructor and fall-through. 520 // Reload the original constructor and fall-through.
504 __ bind(&rt_call_reload_new_target); 521 __ bind(&rt_call_reload_new_target);
505 __ lw(a3, MemOperand(sp, 0 * kPointerSize)); 522 __ lw(a3, MemOperand(sp, 0 * kPointerSize));
506 } 523 }
507 524
508 // Allocate the new receiver object using the runtime call. 525 // Allocate the new receiver object using the runtime call.
509 // a1: constructor function 526 // a1: constructor function
510 // a3: original constructor 527 // a3: original constructor
511 __ bind(&rt_call); 528 __ bind(&rt_call);
512 529
513 __ Push(a1, a3); // arguments 2-3 / 1-2 530 __ Push(a1, a3); // constructor function, original constructor
514 __ CallRuntime(Runtime::kNewObject, 2); 531 __ CallRuntime(Runtime::kNewObject, 2);
515 __ mov(t4, v0); 532 __ mov(t4, v0);
516 533
517 // Receiver for constructor call allocated. 534 // Receiver for constructor call allocated.
518 // t4: JSObject 535 // t4: JSObject
519 __ bind(&allocated); 536 __ bind(&allocated);
520 537
521 // Restore the parameters. 538 // Restore the parameters.
522 __ Pop(a3); // new.target 539 __ Pop(a3); // new.target
523 __ Pop(a1); 540 __ Pop(a1);
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 } 1946 }
1930 } 1947 }
1931 1948
1932 1949
1933 #undef __ 1950 #undef __
1934 1951
1935 } // namespace internal 1952 } // namespace internal
1936 } // namespace v8 1953 } // namespace v8
1937 1954
1938 #endif // V8_TARGET_ARCH_MIPS 1955 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698