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

Side by Side Diff: src/a64/stub-cache-a64.cc

Issue 133443009: A64: Synchronize with r17441. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « src/a64/regexp-macro-assembler-a64.h ('k') | src/allocation-site-scopes.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 Label* miss) { 386 Label* miss) {
387 Handle<Cell> cell = GlobalObject::EnsurePropertyCell(global, name); 387 Handle<Cell> cell = GlobalObject::EnsurePropertyCell(global, name);
388 ASSERT(cell->value()->IsTheHole()); 388 ASSERT(cell->value()->IsTheHole());
389 __ Mov(scratch, Operand(cell)); 389 __ Mov(scratch, Operand(cell));
390 __ Ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset)); 390 __ Ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
391 __ Cmp(scratch, the_hole); 391 __ Cmp(scratch, the_hole);
392 __ B(ne, miss); 392 __ B(ne, miss);
393 } 393 }
394 394
395 395
396 void BaseStoreStubCompiler::GenerateNegativeHolderLookup( 396 void StoreStubCompiler::GenerateNegativeHolderLookup(
397 MacroAssembler* masm, 397 MacroAssembler* masm,
398 Handle<JSObject> holder, 398 Handle<JSObject> holder,
399 Register holder_reg, 399 Register holder_reg,
400 Handle<Name> name, 400 Handle<Name> name,
401 Label* miss) { 401 Label* miss) {
402 if (holder->IsJSGlobalObject()) { 402 if (holder->IsJSGlobalObject()) {
403 __ LoadRoot(scratch2(), Heap::kTheHoleValueRootIndex); 403 __ LoadRoot(scratch2(), Heap::kTheHoleValueRootIndex);
404 GenerateCheckPropertyCell( 404 GenerateCheckPropertyCell(
405 masm, Handle<GlobalObject>::cast(holder), name, 405 masm, Handle<GlobalObject>::cast(holder), name,
406 scratch1(), scratch2(), miss); 406 scratch1(), scratch2(), miss);
407 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) { 407 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) {
408 GenerateDictionaryNegativeLookup( 408 GenerateDictionaryNegativeLookup(
409 masm, miss, holder_reg, name, scratch1(), scratch2()); 409 masm, miss, holder_reg, name, scratch1(), scratch2());
410 } 410 }
411 } 411 }
412 412
413 413
414 // Generate StoreTransition code, value is passed in x0 register. 414 // Generate StoreTransition code, value is passed in x0 register.
415 // When leaving generated code after success, the receiver_reg and storage_reg 415 // When leaving generated code after success, the receiver_reg and storage_reg
416 // may be clobbered. Upon branch to miss_label, the receiver and name registers 416 // may be clobbered. Upon branch to miss_label, the receiver and name registers
417 // have their original values. 417 // have their original values.
418 void BaseStoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm, 418 void StoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm,
419 Handle<JSObject> object, 419 Handle<JSObject> object,
420 LookupResult* lookup, 420 LookupResult* lookup,
421 Handle<Map> transition, 421 Handle<Map> transition,
422 Handle<Name> name, 422 Handle<Name> name,
423 Register receiver_reg, 423 Register receiver_reg,
424 Register storage_reg, 424 Register storage_reg,
425 Register value_reg, 425 Register value_reg,
426 Register scratch1, 426 Register scratch1,
427 Register scratch2, 427 Register scratch2,
428 Register scratch3, 428 Register scratch3,
429 Label* miss_label, 429 Label* miss_label,
430 Label* slow) { 430 Label* slow) {
431 Label exit; 431 Label exit;
432 432
433 ASSERT(!AreAliased(receiver_reg, storage_reg, value_reg, 433 ASSERT(!AreAliased(receiver_reg, storage_reg, value_reg,
434 scratch1, scratch2, scratch3)); 434 scratch1, scratch2, scratch3));
435 435
436 // We don't need scratch3. 436 // We don't need scratch3.
437 scratch3 = NoReg; 437 scratch3 = NoReg;
438 438
439 int descriptor = transition->LastAdded(); 439 int descriptor = transition->LastAdded();
440 DescriptorArray* descriptors = transition->instance_descriptors(); 440 DescriptorArray* descriptors = transition->instance_descriptors();
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 // Return the value (register x0). 576 // Return the value (register x0).
577 ASSERT(value_reg.is(x0)); 577 ASSERT(value_reg.is(x0));
578 __ Ret(); 578 __ Ret();
579 } 579 }
580 580
581 581
582 // Generate StoreField code, value is passed in x0 register. 582 // Generate StoreField code, value is passed in x0 register.
583 // When leaving generated code after success, the receiver_reg and name_reg may 583 // When leaving generated code after success, the receiver_reg and name_reg may
584 // be clobbered. Upon branch to miss_label, the receiver and name registers have 584 // be clobbered. Upon branch to miss_label, the receiver and name registers have
585 // their original values. 585 // their original values.
586 void BaseStoreStubCompiler::GenerateStoreField(MacroAssembler* masm, 586 void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm,
587 Handle<JSObject> object, 587 Handle<JSObject> object,
588 LookupResult* lookup, 588 LookupResult* lookup,
589 Register receiver_reg, 589 Register receiver_reg,
590 Register name_reg, 590 Register name_reg,
591 Register value_reg, 591 Register value_reg,
592 Register scratch1, 592 Register scratch1,
593 Register scratch2, 593 Register scratch2,
594 Label* miss_label) { 594 Label* miss_label) {
595 // x0 : value 595 // x0 : value
596 Label exit; 596 Label exit;
597 597
598 // Stub never generated for non-global objects that require access 598 // Stub never generated for non-global objects that require access
599 // checks. 599 // checks.
600 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); 600 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
601 601
602 int index = lookup->GetFieldIndex().field_index(); 602 int index = lookup->GetFieldIndex().field_index();
603 603
604 // Adjust for the number of properties stored in the object. Even in the 604 // Adjust for the number of properties stored in the object. Even in the
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 } 696 }
697 } 697 }
698 698
699 __ Bind(&exit); 699 __ Bind(&exit);
700 // Return the value (register x0). 700 // Return the value (register x0).
701 ASSERT(value_reg.is(x0)); 701 ASSERT(value_reg.is(x0));
702 __ Ret(); 702 __ Ret();
703 } 703 }
704 704
705 705
706 void BaseStoreStubCompiler::GenerateRestoreName(MacroAssembler* masm, 706 void StoreStubCompiler::GenerateRestoreName(MacroAssembler* masm,
707 Label* label, 707 Label* label,
708 Handle<Name> name) { 708 Handle<Name> name) {
709 if (!label->is_unused()) { 709 if (!label->is_unused()) {
710 __ Bind(label); 710 __ Bind(label);
711 __ Mov(this->name(), Operand(name)); 711 __ Mov(this->name(), Operand(name));
712 } 712 }
713 } 713 }
714 714
715 715
716 // Calls GenerateCheckPropertyCell for each global object in the prototype chain 716 // Calls GenerateCheckPropertyCell for each global object in the prototype chain
717 // from object to (but not including) holder. 717 // from object to (but not including) holder.
718 static void GenerateCheckPropertyCells(MacroAssembler* masm, 718 static void GenerateCheckPropertyCells(MacroAssembler* masm,
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 // their maps haven't changed. We also need to check that the property 1296 // their maps haven't changed. We also need to check that the property
1297 // cell for the property is still empty. 1297 // cell for the property is still empty.
1298 GenerateCheckPropertyCells(masm(), object, holder, name, 1298 GenerateCheckPropertyCells(masm(), object, holder, name,
1299 scratch1, scratch2, miss); 1299 scratch1, scratch2, miss);
1300 1300
1301 // Return the register containing the holder. 1301 // Return the register containing the holder.
1302 return reg; 1302 return reg;
1303 } 1303 }
1304 1304
1305 1305
1306 void BaseLoadStubCompiler::HandlerFrontendFooter(Handle<Name> name, 1306 void LoadStubCompiler::HandlerFrontendFooter(Handle<Name> name,
1307 Label* success, 1307 Label* success,
1308 Label* miss) { 1308 Label* miss) {
1309 if (!miss->is_unused()) { 1309 if (!miss->is_unused()) {
1310 __ B(success); 1310 __ B(success);
1311 __ Bind(miss); 1311 __ Bind(miss);
1312 TailCallBuiltin(masm(), MissBuiltin(kind())); 1312 TailCallBuiltin(masm(), MissBuiltin(kind()));
1313 } 1313 }
1314 } 1314 }
1315 1315
1316 1316
1317 void BaseStoreStubCompiler::HandlerFrontendFooter(Handle<Name> name, 1317 void StoreStubCompiler::HandlerFrontendFooter(Handle<Name> name,
1318 Label* success, 1318 Label* success,
1319 Label* miss) { 1319 Label* miss) {
1320 if (!miss->is_unused()) { 1320 if (!miss->is_unused()) {
1321 __ B(success); 1321 __ B(success);
1322 GenerateRestoreName(masm(), miss, name); 1322 GenerateRestoreName(masm(), miss, name);
1323 TailCallBuiltin(masm(), MissBuiltin(kind())); 1323 TailCallBuiltin(masm(), MissBuiltin(kind()));
1324 } 1324 }
1325 } 1325 }
1326 1326
1327 1327
1328 Register BaseLoadStubCompiler::CallbackHandlerFrontend( 1328 Register LoadStubCompiler::CallbackHandlerFrontend(Handle<JSObject> object,
1329 Handle<JSObject> object, 1329 Register object_reg,
1330 Register object_reg, 1330 Handle<JSObject> holder,
1331 Handle<JSObject> holder, 1331 Handle<Name> name,
1332 Handle<Name> name, 1332 Label* success,
1333 Label* success, 1333 Handle<Object> callback) {
1334 Handle<Object> callback) {
1335 Label miss; 1334 Label miss;
1336 1335
1337 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); 1336 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss);
1338 1337
1339 // TODO(jbramely): HandlerFrontendHeader returns its result in scratch1(), so 1338 // TODO(jbramely): HandlerFrontendHeader returns its result in scratch1(), so
1340 // we can't use it below, but that isn't very obvious. Is there a better way 1339 // we can't use it below, but that isn't very obvious. Is there a better way
1341 // of handling this? 1340 // of handling this?
1342 1341
1343 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { 1342 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
1344 ASSERT(!AreAliased(reg, scratch2(), scratch3(), scratch4())); 1343 ASSERT(!AreAliased(reg, scratch2(), scratch3(), scratch4()));
(...skipping 22 matching lines...) Expand all
1367 __ Ldr(scratch2(), FieldMemOperand(pointer, kValueOffset)); 1366 __ Ldr(scratch2(), FieldMemOperand(pointer, kValueOffset));
1368 __ Cmp(scratch2(), Operand(callback)); 1367 __ Cmp(scratch2(), Operand(callback));
1369 __ B(ne, &miss); 1368 __ B(ne, &miss);
1370 } 1369 }
1371 1370
1372 HandlerFrontendFooter(name, success, &miss); 1371 HandlerFrontendFooter(name, success, &miss);
1373 return reg; 1372 return reg;
1374 } 1373 }
1375 1374
1376 1375
1377 void BaseLoadStubCompiler::NonexistentHandlerFrontend( 1376 void LoadStubCompiler::NonexistentHandlerFrontend(Handle<JSObject> object,
1378 Handle<JSObject> object, 1377 Handle<JSObject> last,
1379 Handle<JSObject> last, 1378 Handle<Name> name,
1380 Handle<Name> name, 1379 Label* success,
1381 Label* success, 1380 Handle<GlobalObject> global) {
1382 Handle<GlobalObject> global) {
1383 Label miss; 1381 Label miss;
1384 1382
1385 HandlerFrontendHeader(object, receiver(), last, name, &miss); 1383 HandlerFrontendHeader(object, receiver(), last, name, &miss);
1386 1384
1387 // If the last object in the prototype chain is a global object, 1385 // If the last object in the prototype chain is a global object,
1388 // check that the global property cell is empty. 1386 // check that the global property cell is empty.
1389 if (!global.is_null()) { 1387 if (!global.is_null()) {
1390 GenerateCheckPropertyCell(masm(), global, name, 1388 GenerateCheckPropertyCell(masm(), global, name,
1391 scratch1(), scratch2(), &miss); 1389 scratch1(), scratch2(), &miss);
1392 } 1390 }
1393 1391
1394 HandlerFrontendFooter(name, success, &miss); 1392 HandlerFrontendFooter(name, success, &miss);
1395 } 1393 }
1396 1394
1397 1395
1398 void BaseLoadStubCompiler::GenerateLoadField(Register reg, 1396 void LoadStubCompiler::GenerateLoadField(Register reg,
1399 Handle<JSObject> holder, 1397 Handle<JSObject> holder,
1400 PropertyIndex field, 1398 PropertyIndex field,
1401 Representation representation) { 1399 Representation representation) {
1402 __ Mov(receiver(), reg); 1400 __ Mov(receiver(), reg);
1403 if (kind() == Code::LOAD_IC) { 1401 if (kind() == Code::LOAD_IC) {
1404 LoadFieldStub stub(field.is_inobject(holder), 1402 LoadFieldStub stub(field.is_inobject(holder),
1405 field.translate(holder), 1403 field.translate(holder),
1406 representation); 1404 representation);
1407 GenerateTailCall(masm(), stub.GetCode(isolate())); 1405 GenerateTailCall(masm(), stub.GetCode(isolate()));
1408 } else { 1406 } else {
1409 KeyedLoadFieldStub stub(field.is_inobject(holder), 1407 KeyedLoadFieldStub stub(field.is_inobject(holder),
1410 field.translate(holder), 1408 field.translate(holder),
1411 representation); 1409 representation);
1412 GenerateTailCall(masm(), stub.GetCode(isolate())); 1410 GenerateTailCall(masm(), stub.GetCode(isolate()));
1413 } 1411 }
1414 } 1412 }
1415 1413
1416 1414
1417 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { 1415 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
1418 // Return the constant value. 1416 // Return the constant value.
1419 __ LoadObject(x0, value); 1417 __ LoadObject(x0, value);
1420 __ Ret(); 1418 __ Ret();
1421 } 1419 }
1422 1420
1423 1421
1424 void BaseLoadStubCompiler::GenerateLoadCallback( 1422 void LoadStubCompiler::GenerateLoadCallback(
1425 const CallOptimization& call_optimization) { 1423 const CallOptimization& call_optimization) {
1426 GenerateFastApiCall( 1424 GenerateFastApiCall(
1427 masm(), call_optimization, receiver(), scratch3(), 0, NULL); 1425 masm(), call_optimization, receiver(), scratch3(), 0, NULL);
1428 } 1426 }
1429 1427
1430 1428
1431 void BaseLoadStubCompiler::GenerateLoadCallback( 1429 void LoadStubCompiler::GenerateLoadCallback(
1432 Register reg, 1430 Register reg,
1433 Handle<ExecutableAccessorInfo> callback) { 1431 Handle<ExecutableAccessorInfo> callback) {
1434 ASSERT(!AreAliased(scratch2(), scratch3(), scratch4(), reg)); 1432 ASSERT(!AreAliased(scratch2(), scratch3(), scratch4(), reg));
1435 1433
1436 // Build ExecutableAccessorInfo::args_ list on the stack and push property 1434 // Build ExecutableAccessorInfo::args_ list on the stack and push property
1437 // name below the exit frame to make GC aware of them and store pointers to 1435 // name below the exit frame to make GC aware of them and store pointers to
1438 // them. 1436 // them.
1439 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); 1437 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0);
1440 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); 1438 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1);
1441 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); 1439 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 getter_address, 1519 getter_address,
1522 thunk_ref, 1520 thunk_ref,
1523 x2, 1521 x2,
1524 kStackUnwindSpace, 1522 kStackUnwindSpace,
1525 spill_offset, 1523 spill_offset,
1526 MemOperand(fp, 6 * kPointerSize), 1524 MemOperand(fp, 6 * kPointerSize),
1527 NULL); 1525 NULL);
1528 } 1526 }
1529 1527
1530 1528
1531 void BaseLoadStubCompiler::GenerateLoadInterceptor( 1529 void LoadStubCompiler::GenerateLoadInterceptor(
1532 Register holder_reg, 1530 Register holder_reg,
1533 Handle<JSObject> object, 1531 Handle<JSObject> object,
1534 Handle<JSObject> interceptor_holder, 1532 Handle<JSObject> interceptor_holder,
1535 LookupResult* lookup, 1533 LookupResult* lookup,
1536 Handle<Name> name) { 1534 Handle<Name> name) {
1537 ASSERT(!AreAliased(receiver(), this->name(), 1535 ASSERT(!AreAliased(receiver(), this->name(),
1538 scratch1(), scratch2(), scratch3())); 1536 scratch1(), scratch2(), scratch3()));
1539 ASSERT(interceptor_holder->HasNamedInterceptor()); 1537 ASSERT(interceptor_holder->HasNamedInterceptor());
1540 ASSERT(!interceptor_holder->GetNamedInterceptor()->getter()->IsUndefined()); 1538 ASSERT(!interceptor_holder->GetNamedInterceptor()->getter()->IsUndefined());
1541 1539
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after
3069 Label* miss) { 3067 Label* miss) {
3070 __ Cmp(name_reg, Operand(name)); 3068 __ Cmp(name_reg, Operand(name));
3071 __ B(ne, miss); 3069 __ B(ne, miss);
3072 } 3070 }
3073 3071
3074 3072
3075 #undef __ 3073 #undef __
3076 #define __ ACCESS_MASM(masm) 3074 #define __ ACCESS_MASM(masm)
3077 3075
3078 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, 3076 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
3077 Register receiver,
3079 Handle<JSFunction> getter) { 3078 Handle<JSFunction> getter) {
3080 // ----------- S t a t e ------------- 3079 // ----------- S t a t e -------------
3081 // -- x0 : receiver 3080 // -- x0 : receiver
3082 // -- x2 : name 3081 // -- x2 : name
3083 // -- lr : return address 3082 // -- lr : return address
3084 // ----------------------------------- 3083 // -----------------------------------
3084 ASSERT(receiver.Is(x0));
3085 { 3085 {
3086 FrameScope scope(masm, StackFrame::INTERNAL); 3086 FrameScope scope(masm, StackFrame::INTERNAL);
3087 3087
3088 if (!getter.is_null()) { 3088 if (!getter.is_null()) {
3089 // Call the JavaScript getter with the receiver on the stack. 3089 // Call the JavaScript getter with the receiver on the stack.
3090 __ Push(x0); 3090 __ Push(receiver);
3091 ParameterCount actual(0); 3091 ParameterCount actual(0);
3092 ParameterCount expected(getter); 3092 ParameterCount expected(getter);
3093 __ InvokeFunction(getter, expected, actual, 3093 __ InvokeFunction(getter, expected, actual,
3094 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); 3094 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
3095 } else { 3095 } else {
3096 // If we generate a global code snippet for deoptimization only, remember 3096 // If we generate a global code snippet for deoptimization only, remember
3097 // the place to continue after deoptimization. 3097 // the place to continue after deoptimization.
3098 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); 3098 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset());
3099 } 3099 }
3100 3100
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
3265 3265
3266 // Miss case, call the runtime. 3266 // Miss case, call the runtime.
3267 __ Bind(&miss_force_generic); 3267 __ Bind(&miss_force_generic);
3268 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3268 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3269 } 3269 }
3270 3270
3271 3271
3272 } } // namespace v8::internal 3272 } } // namespace v8::internal
3273 3273
3274 #endif // V8_TARGET_ARCH_A64 3274 #endif // V8_TARGET_ARCH_A64
OLDNEW
« no previous file with comments | « src/a64/regexp-macro-assembler-a64.h ('k') | src/allocation-site-scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698