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

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 3156028: Change code pointer in function objects to a pointer to the first... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 4 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/arm/macro-assembler-arm.h ('k') | src/ia32/builtins-ia32.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 Register expected_reg = r2; 750 Register expected_reg = r2;
751 Register code_reg = r3; 751 Register code_reg = r3;
752 752
753 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 753 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
754 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 754 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
755 ldr(expected_reg, 755 ldr(expected_reg,
756 FieldMemOperand(code_reg, 756 FieldMemOperand(code_reg,
757 SharedFunctionInfo::kFormalParameterCountOffset)); 757 SharedFunctionInfo::kFormalParameterCountOffset));
758 mov(expected_reg, Operand(expected_reg, ASR, kSmiTagSize)); 758 mov(expected_reg, Operand(expected_reg, ASR, kSmiTagSize));
759 ldr(code_reg, 759 ldr(code_reg,
760 MemOperand(r1, JSFunction::kCodeOffset - kHeapObjectTag)); 760 FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
761 add(code_reg, code_reg, Operand(Code::kHeaderSize - kHeapObjectTag));
762 761
763 ParameterCount expected(expected_reg); 762 ParameterCount expected(expected_reg);
764 InvokeCode(code_reg, expected, actual, flag); 763 InvokeCode(code_reg, expected, actual, flag);
765 } 764 }
766 765
767 766
768 void MacroAssembler::InvokeFunction(JSFunction* function, 767 void MacroAssembler::InvokeFunction(JSFunction* function,
769 const ParameterCount& actual, 768 const ParameterCount& actual,
770 InvokeFlag flag) { 769 InvokeFlag flag) {
771 ASSERT(function->is_compiled()); 770 ASSERT(function->is_compiled());
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 GetBuiltinEntry(r2, id); 1482 GetBuiltinEntry(r2, id);
1484 if (flags == CALL_JS) { 1483 if (flags == CALL_JS) {
1485 Call(r2); 1484 Call(r2);
1486 } else { 1485 } else {
1487 ASSERT(flags == JUMP_JS); 1486 ASSERT(flags == JUMP_JS);
1488 Jump(r2); 1487 Jump(r2);
1489 } 1488 }
1490 } 1489 }
1491 1490
1492 1491
1492 void MacroAssembler::GetBuiltinFunction(Register target,
1493 Builtins::JavaScript id) {
1494 // Load the builtins object into target register.
1495 ldr(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
1496 ldr(target, FieldMemOperand(target, GlobalObject::kBuiltinsOffset));
1497 // Load the JavaScript builtin function from the builtins object.
1498 ldr(target, FieldMemOperand(target,
1499 JSBuiltinsObject::OffsetOfFunctionWithId(id)));
1500 }
1501
1502
1493 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { 1503 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) {
1494 ASSERT(!target.is(r1)); 1504 ASSERT(!target.is(r1));
1495 1505 GetBuiltinFunction(r1, id);
1496 // Load the builtins object into target register.
1497 ldr(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
1498 ldr(target, FieldMemOperand(target, GlobalObject::kBuiltinsOffset));
1499
1500 // Load the JavaScript builtin function from the builtins object.
1501 ldr(r1, FieldMemOperand(target,
1502 JSBuiltinsObject::OffsetOfFunctionWithId(id)));
1503
1504 // Load the code entry point from the builtins object. 1506 // Load the code entry point from the builtins object.
1505 ldr(target, FieldMemOperand(target, 1507 ldr(target, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1506 JSBuiltinsObject::OffsetOfCodeWithId(id)));
1507 if (FLAG_debug_code) {
1508 // Make sure the code objects in the builtins object and in the
1509 // builtin function are the same.
1510 push(r1);
1511 ldr(r1, FieldMemOperand(r1, JSFunction::kCodeOffset));
1512 cmp(r1, target);
1513 Assert(eq, "Builtin code object changed");
1514 pop(r1);
1515 }
1516 add(target, target, Operand(Code::kHeaderSize - kHeapObjectTag));
1517 } 1508 }
1518 1509
1519 1510
1520 void MacroAssembler::SetCounter(StatsCounter* counter, int value, 1511 void MacroAssembler::SetCounter(StatsCounter* counter, int value,
1521 Register scratch1, Register scratch2) { 1512 Register scratch1, Register scratch2) {
1522 if (FLAG_native_code_counters && counter->Enabled()) { 1513 if (FLAG_native_code_counters && counter->Enabled()) {
1523 mov(scratch1, Operand(value)); 1514 mov(scratch1, Operand(value));
1524 mov(scratch2, Operand(ExternalReference(counter))); 1515 mov(scratch2, Operand(ExternalReference(counter)));
1525 str(scratch1, MemOperand(scratch2)); 1516 str(scratch1, MemOperand(scratch2));
1526 } 1517 }
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 1927
1937 void CodePatcher::Emit(Address addr) { 1928 void CodePatcher::Emit(Address addr) {
1938 masm()->emit(reinterpret_cast<Instr>(addr)); 1929 masm()->emit(reinterpret_cast<Instr>(addr));
1939 } 1930 }
1940 #endif // ENABLE_DEBUGGER_SUPPORT 1931 #endif // ENABLE_DEBUGGER_SUPPORT
1941 1932
1942 1933
1943 } } // namespace v8::internal 1934 } } // namespace v8::internal
1944 1935
1945 #endif // V8_TARGET_ARCH_ARM 1936 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698