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

Side by Side Diff: src/code-stubs.h

Issue 70203002: Simplify Hydrogen code stubs with variable argument count (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/code-stubs.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 // 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 virtual Code::Kind GetCodeKind() const { return Code::STUB; } 271 virtual Code::Kind GetCodeKind() const { return Code::STUB; }
272 272
273 protected: 273 protected:
274 // Generates the assembler code for the stub. 274 // Generates the assembler code for the stub.
275 virtual void Generate(MacroAssembler* masm) = 0; 275 virtual void Generate(MacroAssembler* masm) = 0;
276 }; 276 };
277 277
278 278
279 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; 279 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE };
280 280 enum HandlerArgumentsMode { DONT_PASS_ARGUMENTS, PASS_ARGUMENTS };
281 281
282 struct CodeStubInterfaceDescriptor { 282 struct CodeStubInterfaceDescriptor {
283 CodeStubInterfaceDescriptor(); 283 CodeStubInterfaceDescriptor();
284 int register_param_count_; 284 int register_param_count_;
285
285 Register stack_parameter_count_; 286 Register stack_parameter_count_;
286 // if hint_stack_parameter_count_ > 0, the code stub can optimize the 287 // if hint_stack_parameter_count_ > 0, the code stub can optimize the
287 // return sequence. Default value is -1, which means it is ignored. 288 // return sequence. Default value is -1, which means it is ignored.
288 int hint_stack_parameter_count_; 289 int hint_stack_parameter_count_;
289 StubFunctionMode function_mode_; 290 StubFunctionMode function_mode_;
290 Register* register_params_; 291 Register* register_params_;
292
291 Address deoptimization_handler_; 293 Address deoptimization_handler_;
294 HandlerArgumentsMode handler_arguments_mode_;
292 295
293 int environment_length() const { 296 int environment_length() const {
294 if (stack_parameter_count_.is_valid()) {
295 return register_param_count_ + 1;
296 }
297 return register_param_count_; 297 return register_param_count_;
298 } 298 }
299 299
300 bool initialized() const { return register_param_count_ >= 0; } 300 bool initialized() const { return register_param_count_ >= 0; }
301 301
302 void SetMissHandler(ExternalReference handler) { 302 void SetMissHandler(ExternalReference handler) {
303 miss_handler_ = handler; 303 miss_handler_ = handler;
304 has_miss_handler_ = true; 304 has_miss_handler_ = true;
305 // Our miss handler infrastructure doesn't currently support
306 // variable stack parameter counts.
307 ASSERT(!stack_parameter_count_.is_valid());
305 } 308 }
306 309
307 ExternalReference miss_handler() { 310 ExternalReference miss_handler() {
308 ASSERT(has_miss_handler_); 311 ASSERT(has_miss_handler_);
309 return miss_handler_; 312 return miss_handler_;
310 } 313 }
311 314
312 bool has_miss_handler() { 315 bool has_miss_handler() {
313 return has_miss_handler_; 316 return has_miss_handler_;
314 } 317 }
315 318
319 Register GetParameterRegister(int index) {
320 return register_params_[index];
321 }
322
323 bool IsParameterCountRegister(int index) {
324 return GetParameterRegister(index).is(stack_parameter_count_);
325 }
326
327 int GetHandlerParameterCount() {
328 int params = environment_length();
329 if (handler_arguments_mode_ == PASS_ARGUMENTS) {
330 params += 1;
331 }
332 return params;
333 }
334
316 private: 335 private:
317 ExternalReference miss_handler_; 336 ExternalReference miss_handler_;
318 bool has_miss_handler_; 337 bool has_miss_handler_;
319 }; 338 };
320 339
321 // A helper to make up for the fact that type Register is not fully
322 // defined outside of the platform directories
323 #define DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index) \
324 ((index) == (descriptor)->register_param_count_) \
325 ? (descriptor)->stack_parameter_count_ \
326 : (descriptor)->register_params_[(index)]
327
328 340
329 class HydrogenCodeStub : public CodeStub { 341 class HydrogenCodeStub : public CodeStub {
330 public: 342 public:
331 enum InitializationState { 343 enum InitializationState {
332 UNINITIALIZED, 344 UNINITIALIZED,
333 INITIALIZED 345 INITIALIZED
334 }; 346 };
335 347
336 explicit HydrogenCodeStub(InitializationState state = INITIALIZED) { 348 explicit HydrogenCodeStub(InitializationState state = INITIALIZED) {
337 is_uninitialized_ = (state == UNINITIALIZED); 349 is_uninitialized_ = (state == UNINITIALIZED);
(...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after
2406 int MinorKey() { return 0; } 2418 int MinorKey() { return 0; }
2407 2419
2408 void Generate(MacroAssembler* masm); 2420 void Generate(MacroAssembler* masm);
2409 2421
2410 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); 2422 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
2411 }; 2423 };
2412 2424
2413 } } // namespace v8::internal 2425 } } // namespace v8::internal
2414 2426
2415 #endif // V8_CODE_STUBS_H_ 2427 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698