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

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

Issue 1413003008: Support fast-path allocation for subclass constructors with correctly initialized initial maps. (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/mips/builtins-mips.cc ('k') | src/objects.h » ('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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // Try to allocate the object without transitioning into C code. If any of 386 // Try to allocate the object without transitioning into C code. If any of
387 // the preconditions is not met, the code bails out to the runtime call. 387 // the preconditions is not met, the code bails out to the runtime call.
388 Label rt_call, allocated; 388 Label rt_call, allocated;
389 if (FLAG_inline_new) { 389 if (FLAG_inline_new) {
390 ExternalReference debug_step_in_fp = 390 ExternalReference debug_step_in_fp =
391 ExternalReference::debug_step_in_fp_address(isolate); 391 ExternalReference::debug_step_in_fp_address(isolate);
392 __ li(a2, Operand(debug_step_in_fp)); 392 __ li(a2, Operand(debug_step_in_fp));
393 __ ld(a2, MemOperand(a2)); 393 __ ld(a2, MemOperand(a2));
394 __ Branch(&rt_call, ne, a2, Operand(zero_reg)); 394 __ Branch(&rt_call, ne, a2, Operand(zero_reg));
395 395
396 // Fall back to runtime if the original constructor and function differ. 396 // Verify that the original constructor is a JSFunction.
397 __ Branch(&rt_call, ne, a1, Operand(a3)); 397 __ GetObjectType(a3, a5, a4);
398 __ Branch(&rt_call, ne, a4, Operand(JS_FUNCTION_TYPE));
398 399
399 // Load the initial map and verify that it is in fact a map. 400 // Load the initial map and verify that it is in fact a map.
400 // a1: constructor function 401 // a3: original constructor
401 __ ld(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); 402 __ ld(a2, FieldMemOperand(a3, JSFunction::kPrototypeOrInitialMapOffset));
402 __ JumpIfSmi(a2, &rt_call); 403 __ JumpIfSmi(a2, &rt_call);
403 __ GetObjectType(a2, t1, t0); 404 __ GetObjectType(a2, t1, t0);
404 __ Branch(&rt_call, ne, t0, Operand(MAP_TYPE)); 405 __ Branch(&rt_call, ne, t0, Operand(MAP_TYPE));
405 406
407 // Fall back to runtime if the expected base constructor and base
408 // constructor differ.
409 __ ld(a5, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset));
410 __ Branch(&rt_call, ne, a1, Operand(a5));
411
406 // Check that the constructor is not constructing a JSFunction (see 412 // Check that the constructor is not constructing a JSFunction (see
407 // comments in Runtime_NewObject in runtime.cc). In which case the 413 // comments in Runtime_NewObject in runtime.cc). In which case the
408 // initial map's instance type would be JS_FUNCTION_TYPE. 414 // initial map's instance type would be JS_FUNCTION_TYPE.
409 // a1: constructor function 415 // a1: constructor function
410 // a2: initial map 416 // a2: initial map
411 __ lbu(t1, FieldMemOperand(a2, Map::kInstanceTypeOffset)); 417 __ lbu(t1, FieldMemOperand(a2, Map::kInstanceTypeOffset));
412 __ Branch(&rt_call, eq, t1, Operand(JS_FUNCTION_TYPE)); 418 __ Branch(&rt_call, eq, t1, Operand(JS_FUNCTION_TYPE));
413 419
414 if (!is_api_function) { 420 if (!is_api_function) {
415 Label allocate; 421 Label allocate;
416 MemOperand bit_field3 = FieldMemOperand(a2, Map::kBitField3Offset); 422 MemOperand bit_field3 = FieldMemOperand(a2, Map::kBitField3Offset);
417 // Check if slack tracking is enabled. 423 // Check if slack tracking is enabled.
418 __ lwu(a4, bit_field3); 424 __ lwu(a4, bit_field3);
419 __ DecodeField<Map::Counter>(a6, a4); 425 __ DecodeField<Map::Counter>(a6, a4);
420 __ Branch(&allocate, lt, a6, 426 __ Branch(&allocate, lt, a6,
421 Operand(static_cast<int64_t>(Map::kSlackTrackingCounterEnd))); 427 Operand(static_cast<int64_t>(Map::kSlackTrackingCounterEnd)));
422 // Decrease generous allocation count. 428 // Decrease generous allocation count.
423 __ Dsubu(a4, a4, Operand(1 << Map::Counter::kShift)); 429 __ Dsubu(a4, a4, Operand(1 << Map::Counter::kShift));
424 __ Branch(USE_DELAY_SLOT, &allocate, ne, a6, 430 __ Branch(USE_DELAY_SLOT, &allocate, ne, a6,
425 Operand(Map::kSlackTrackingCounterEnd)); 431 Operand(Map::kSlackTrackingCounterEnd));
426 __ sw(a4, bit_field3); // In delay slot. 432 __ sw(a4, bit_field3); // In delay slot.
427 433
428 __ Push(a1, a2, a1); // a1 = Constructor. 434 __ Push(a1, a2, a2); // a2 = Initial map.
429 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); 435 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1);
430 436
431 __ Pop(a1, a2); 437 __ Pop(a1, a2);
432 __ li(a6, Operand(Map::kSlackTrackingCounterEnd - 1)); 438 __ li(a6, Operand(Map::kSlackTrackingCounterEnd - 1));
433 439
434 __ bind(&allocate); 440 __ bind(&allocate);
435 } 441 }
436 442
437 // Now allocate the JSObject on the heap. 443 // Now allocate the JSObject on the heap.
438 // a1: constructor function 444 // a1: constructor function
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 } 1963 }
1958 } 1964 }
1959 1965
1960 1966
1961 #undef __ 1967 #undef __
1962 1968
1963 } // namespace internal 1969 } // namespace internal
1964 } // namespace v8 1970 } // namespace v8
1965 1971
1966 #endif // V8_TARGET_ARCH_MIPS64 1972 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698