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

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

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