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

Side by Side Diff: src/compiler/interpreter-assembler.cc

Issue 1316943002: Move (uppercase) JS builtins from js builtins object to native context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove Isolate::js_builtins_object Created 5 years, 3 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
« no previous file with comments | « src/compiler/interpreter-assembler.h ('k') | src/compiler/js-generic-lowering.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include "src/compiler/interpreter-assembler.h" 5 #include "src/compiler/interpreter-assembler.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "src/compiler/graph.h" 9 #include "src/compiler/graph.h"
10 #include "src/compiler/instruction-selector.h" 10 #include "src/compiler/instruction-selector.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 return raw_assembler_->WordSar(value, SmiShiftBitsConstant()); 188 return raw_assembler_->WordSar(value, SmiShiftBitsConstant());
189 } 189 }
190 190
191 191
192 Node* InterpreterAssembler::LoadObjectField(Node* object, int offset) { 192 Node* InterpreterAssembler::LoadObjectField(Node* object, int offset) {
193 return raw_assembler_->Load(kMachAnyTagged, object, 193 return raw_assembler_->Load(kMachAnyTagged, object,
194 IntPtrConstant(offset - kHeapObjectTag)); 194 IntPtrConstant(offset - kHeapObjectTag));
195 } 195 }
196 196
197 197
198 Node* InterpreterAssembler::LoadContextSlot(Node* context, int slot_index) {
199 return raw_assembler_->Load(kMachAnyTagged, context,
200 IntPtrConstant(Context::SlotOffset(slot_index)));
201 }
202
203
198 Node* InterpreterAssembler::LoadContextSlot(int slot_index) { 204 Node* InterpreterAssembler::LoadContextSlot(int slot_index) {
199 return raw_assembler_->Load(kMachAnyTagged, ContextTaggedPointer(), 205 return LoadContextSlot(ContextTaggedPointer(), slot_index);
200 IntPtrConstant(Context::SlotOffset(slot_index)));
201 } 206 }
202 207
203 208
204 Node* InterpreterAssembler::CallJSBuiltin(Builtins::JavaScript builtin, 209 Node* InterpreterAssembler::CallJSBuiltin(int context_index, Node* receiver,
205 Node* receiver, Node** js_args, 210 Node** js_args, int js_arg_count) {
206 int js_arg_count) {
207 Node* global_object = LoadContextSlot(Context::GLOBAL_OBJECT_INDEX); 211 Node* global_object = LoadContextSlot(Context::GLOBAL_OBJECT_INDEX);
208 Node* builtins_object = 212 Node* native_context =
209 LoadObjectField(global_object, GlobalObject::kBuiltinsOffset); 213 LoadObjectField(global_object, GlobalObject::kNativeContextOffset);
210 Node* function = LoadObjectField( 214 Node* function = LoadContextSlot(native_context, context_index);
211 builtins_object, JSBuiltinsObject::OffsetOfFunctionWithId(builtin));
212 Node* context = LoadObjectField(function, JSFunction::kContextOffset); 215 Node* context = LoadObjectField(function, JSFunction::kContextOffset);
213 216
214 int index = 0; 217 int index = 0;
215 Node** args = zone()->NewArray<Node*>(js_arg_count + 2); 218 Node** args = zone()->NewArray<Node*>(js_arg_count + 2);
216 args[index++] = receiver; 219 args[index++] = receiver;
217 for (int i = 0; i < js_arg_count; i++) { 220 for (int i = 0; i < js_arg_count; i++) {
218 args[index++] = js_args[i]; 221 args[index++] = js_args[i];
219 } 222 }
220 args[index++] = context; 223 args[index++] = context;
221 224
222 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor( 225 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(
223 zone(), false, js_arg_count + 1, CallDescriptor::kNoFlags); 226 zone(), false, js_arg_count + 1, CallDescriptor::kNoFlags);
224 return raw_assembler_->CallN(descriptor, function, args); 227 return raw_assembler_->CallN(descriptor, function, args);
225 } 228 }
226 229
227 230
228 Node* InterpreterAssembler::CallJSBuiltin(Builtins::JavaScript builtin, 231 Node* InterpreterAssembler::CallJSBuiltin(int context_index, Node* receiver) {
229 Node* receiver) { 232 return CallJSBuiltin(context_index, receiver, nullptr, 0);
230 return CallJSBuiltin(builtin, receiver, nullptr, 0);
231 } 233 }
232 234
233 235
234 Node* InterpreterAssembler::CallJSBuiltin(Builtins::JavaScript builtin, 236 Node* InterpreterAssembler::CallJSBuiltin(int context_index, Node* receiver,
235 Node* receiver, Node* arg1) { 237 Node* arg1) {
236 return CallJSBuiltin(builtin, receiver, &arg1, 1); 238 return CallJSBuiltin(context_index, receiver, &arg1, 1);
237 } 239 }
238 240
239 241
240 void InterpreterAssembler::Return() { 242 void InterpreterAssembler::Return() {
241 Node* exit_trampoline_code_object = 243 Node* exit_trampoline_code_object =
242 HeapConstant(Unique<HeapObject>::CreateImmovable( 244 HeapConstant(Unique<HeapObject>::CreateImmovable(
243 isolate()->builtins()->InterpreterExitTrampoline())); 245 isolate()->builtins()->InterpreterExitTrampoline()));
244 // If the order of the parameters you need to change the call signature below. 246 // If the order of the parameters you need to change the call signature below.
245 STATIC_ASSERT(0 == Linkage::kInterpreterAccumulatorParameter); 247 STATIC_ASSERT(0 == Linkage::kInterpreterAccumulatorParameter);
246 STATIC_ASSERT(1 == Linkage::kInterpreterRegisterFileParameter); 248 STATIC_ASSERT(1 == Linkage::kInterpreterRegisterFileParameter);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 return raw_assembler_->schedule(); 330 return raw_assembler_->schedule();
329 } 331 }
330 332
331 333
332 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } 334 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); }
333 335
334 336
335 } // namespace interpreter 337 } // namespace interpreter
336 } // namespace internal 338 } // namespace internal
337 } // namespace v8 339 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/interpreter-assembler.h ('k') | src/compiler/js-generic-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698