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

Side by Side Diff: src/ic.cc

Issue 250553005: Added an Isolate* field to NoTrackDoubleFieldsForSerializerScope, PlatformFeatureScope and BinaryOp… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Feedback. Rebased. Created 6 years, 8 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/ic.h ('k') | src/type-info.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 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 } 2051 }
2052 Handle<Object> result; 2052 Handle<Object> result;
2053 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2053 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2054 isolate, result, 2054 isolate, result,
2055 Runtime::SetObjectProperty( 2055 Runtime::SetObjectProperty(
2056 isolate, object, key, value, NONE, strict_mode)); 2056 isolate, object, key, value, NONE, strict_mode));
2057 return *result; 2057 return *result;
2058 } 2058 }
2059 2059
2060 2060
2061 BinaryOpIC::State::State(ExtraICState extra_ic_state) { 2061 BinaryOpIC::State::State(Isolate* isolate, ExtraICState extra_ic_state)
2062 : isolate_(isolate) {
2062 // We don't deserialize the SSE2 Field, since this is only used to be able 2063 // We don't deserialize the SSE2 Field, since this is only used to be able
2063 // to include SSE2 as well as non-SSE2 versions in the snapshot. For code 2064 // to include SSE2 as well as non-SSE2 versions in the snapshot. For code
2064 // generation we always want it to reflect the current state. 2065 // generation we always want it to reflect the current state.
2065 op_ = static_cast<Token::Value>( 2066 op_ = static_cast<Token::Value>(
2066 FIRST_TOKEN + OpField::decode(extra_ic_state)); 2067 FIRST_TOKEN + OpField::decode(extra_ic_state));
2067 mode_ = OverwriteModeField::decode(extra_ic_state); 2068 mode_ = OverwriteModeField::decode(extra_ic_state);
2068 fixed_right_arg_ = Maybe<int>( 2069 fixed_right_arg_ = Maybe<int>(
2069 HasFixedRightArgField::decode(extra_ic_state), 2070 HasFixedRightArgField::decode(extra_ic_state),
2070 1 << FixedRightArgValueField::decode(extra_ic_state)); 2071 1 << FixedRightArgValueField::decode(extra_ic_state));
2071 left_kind_ = LeftKindField::decode(extra_ic_state); 2072 left_kind_ = LeftKindField::decode(extra_ic_state);
(...skipping 30 matching lines...) Expand all
2102 2103
2103 // static 2104 // static
2104 void BinaryOpIC::State::GenerateAheadOfTime( 2105 void BinaryOpIC::State::GenerateAheadOfTime(
2105 Isolate* isolate, void (*Generate)(Isolate*, const State&)) { 2106 Isolate* isolate, void (*Generate)(Isolate*, const State&)) {
2106 // TODO(olivf) We should investigate why adding stubs to the snapshot is so 2107 // TODO(olivf) We should investigate why adding stubs to the snapshot is so
2107 // expensive at runtime. When solved we should be able to add most binops to 2108 // expensive at runtime. When solved we should be able to add most binops to
2108 // the snapshot instead of hand-picking them. 2109 // the snapshot instead of hand-picking them.
2109 // Generated list of commonly used stubs 2110 // Generated list of commonly used stubs
2110 #define GENERATE(op, left_kind, right_kind, result_kind, mode) \ 2111 #define GENERATE(op, left_kind, right_kind, result_kind, mode) \
2111 do { \ 2112 do { \
2112 State state(op, mode); \ 2113 State state(isolate, op, mode); \
2113 state.left_kind_ = left_kind; \ 2114 state.left_kind_ = left_kind; \
2114 state.fixed_right_arg_.has_value = false; \ 2115 state.fixed_right_arg_.has_value = false; \
2115 state.right_kind_ = right_kind; \ 2116 state.right_kind_ = right_kind; \
2116 state.result_kind_ = result_kind; \ 2117 state.result_kind_ = result_kind; \
2117 Generate(isolate, state); \ 2118 Generate(isolate, state); \
2118 } while (false) 2119 } while (false)
2119 GENERATE(Token::ADD, INT32, INT32, INT32, NO_OVERWRITE); 2120 GENERATE(Token::ADD, INT32, INT32, INT32, NO_OVERWRITE);
2120 GENERATE(Token::ADD, INT32, INT32, INT32, OVERWRITE_LEFT); 2121 GENERATE(Token::ADD, INT32, INT32, INT32, OVERWRITE_LEFT);
2121 GENERATE(Token::ADD, INT32, INT32, NUMBER, NO_OVERWRITE); 2122 GENERATE(Token::ADD, INT32, INT32, NUMBER, NO_OVERWRITE);
2122 GENERATE(Token::ADD, INT32, INT32, NUMBER, OVERWRITE_LEFT); 2123 GENERATE(Token::ADD, INT32, INT32, NUMBER, OVERWRITE_LEFT);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
2297 GENERATE(Token::SUB, SMI, INT32, INT32, NO_OVERWRITE); 2298 GENERATE(Token::SUB, SMI, INT32, INT32, NO_OVERWRITE);
2298 GENERATE(Token::SUB, SMI, NUMBER, NUMBER, NO_OVERWRITE); 2299 GENERATE(Token::SUB, SMI, NUMBER, NUMBER, NO_OVERWRITE);
2299 GENERATE(Token::SUB, SMI, NUMBER, NUMBER, OVERWRITE_LEFT); 2300 GENERATE(Token::SUB, SMI, NUMBER, NUMBER, OVERWRITE_LEFT);
2300 GENERATE(Token::SUB, SMI, NUMBER, NUMBER, OVERWRITE_RIGHT); 2301 GENERATE(Token::SUB, SMI, NUMBER, NUMBER, OVERWRITE_RIGHT);
2301 GENERATE(Token::SUB, SMI, SMI, SMI, NO_OVERWRITE); 2302 GENERATE(Token::SUB, SMI, SMI, SMI, NO_OVERWRITE);
2302 GENERATE(Token::SUB, SMI, SMI, SMI, OVERWRITE_LEFT); 2303 GENERATE(Token::SUB, SMI, SMI, SMI, OVERWRITE_LEFT);
2303 GENERATE(Token::SUB, SMI, SMI, SMI, OVERWRITE_RIGHT); 2304 GENERATE(Token::SUB, SMI, SMI, SMI, OVERWRITE_RIGHT);
2304 #undef GENERATE 2305 #undef GENERATE
2305 #define GENERATE(op, left_kind, fixed_right_arg_value, result_kind, mode) \ 2306 #define GENERATE(op, left_kind, fixed_right_arg_value, result_kind, mode) \
2306 do { \ 2307 do { \
2307 State state(op, mode); \ 2308 State state(isolate, op, mode); \
2308 state.left_kind_ = left_kind; \ 2309 state.left_kind_ = left_kind; \
2309 state.fixed_right_arg_.has_value = true; \ 2310 state.fixed_right_arg_.has_value = true; \
2310 state.fixed_right_arg_.value = fixed_right_arg_value; \ 2311 state.fixed_right_arg_.value = fixed_right_arg_value; \
2311 state.right_kind_ = SMI; \ 2312 state.right_kind_ = SMI; \
2312 state.result_kind_ = result_kind; \ 2313 state.result_kind_ = result_kind; \
2313 Generate(isolate, state); \ 2314 Generate(isolate, state); \
2314 } while (false) 2315 } while (false)
2315 GENERATE(Token::MOD, SMI, 2, SMI, NO_OVERWRITE); 2316 GENERATE(Token::MOD, SMI, 2, SMI, NO_OVERWRITE);
2316 GENERATE(Token::MOD, SMI, 4, SMI, NO_OVERWRITE); 2317 GENERATE(Token::MOD, SMI, 4, SMI, NO_OVERWRITE);
2317 GENERATE(Token::MOD, SMI, 4, SMI, OVERWRITE_LEFT); 2318 GENERATE(Token::MOD, SMI, 4, SMI, OVERWRITE_LEFT);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 } 2476 }
2476 UNREACHABLE(); 2477 UNREACHABLE();
2477 return NULL; 2478 return NULL;
2478 } 2479 }
2479 2480
2480 2481
2481 MaybeHandle<Object> BinaryOpIC::Transition( 2482 MaybeHandle<Object> BinaryOpIC::Transition(
2482 Handle<AllocationSite> allocation_site, 2483 Handle<AllocationSite> allocation_site,
2483 Handle<Object> left, 2484 Handle<Object> left,
2484 Handle<Object> right) { 2485 Handle<Object> right) {
2485 State state(target()->extra_ic_state()); 2486 State state(isolate(), target()->extra_ic_state());
2486 2487
2487 // Compute the actual result using the builtin for the binary operation. 2488 // Compute the actual result using the builtin for the binary operation.
2488 Object* builtin = isolate()->js_builtins_object()->javascript_builtin( 2489 Object* builtin = isolate()->js_builtins_object()->javascript_builtin(
2489 TokenToJSBuiltin(state.op())); 2490 TokenToJSBuiltin(state.op()));
2490 Handle<JSFunction> function = handle(JSFunction::cast(builtin), isolate()); 2491 Handle<JSFunction> function = handle(JSFunction::cast(builtin), isolate());
2491 Handle<Object> result; 2492 Handle<Object> result;
2492 ASSIGN_RETURN_ON_EXCEPTION( 2493 ASSIGN_RETURN_ON_EXCEPTION(
2493 isolate(), 2494 isolate(),
2494 result, 2495 result,
2495 Execution::Call(isolate(), function, left, 1, &right), 2496 Execution::Call(isolate(), function, left, 1, &right),
2496 Object); 2497 Object);
2497 2498
2498 // Execution::Call can execute arbitrary JavaScript, hence potentially 2499 // Execution::Call can execute arbitrary JavaScript, hence potentially
2499 // update the state of this very IC, so we must update the stored state. 2500 // update the state of this very IC, so we must update the stored state.
2500 UpdateTarget(); 2501 UpdateTarget();
2501 // Compute the new state. 2502 // Compute the new state.
2502 State old_state(target()->extra_ic_state()); 2503 State old_state(isolate(), target()->extra_ic_state());
2503 state.Update(left, right, result); 2504 state.Update(left, right, result);
2504 2505
2505 // Check if we have a string operation here. 2506 // Check if we have a string operation here.
2506 Handle<Code> target; 2507 Handle<Code> target;
2507 if (!allocation_site.is_null() || state.ShouldCreateAllocationMementos()) { 2508 if (!allocation_site.is_null() || state.ShouldCreateAllocationMementos()) {
2508 // Setup the allocation site on-demand. 2509 // Setup the allocation site on-demand.
2509 if (allocation_site.is_null()) { 2510 if (allocation_site.is_null()) {
2510 allocation_site = isolate()->factory()->NewAllocationSite(); 2511 allocation_site = isolate()->factory()->NewAllocationSite();
2511 } 2512 }
2512 2513
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
2948 #undef ADDR 2949 #undef ADDR
2949 }; 2950 };
2950 2951
2951 2952
2952 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2953 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2953 return IC_utilities[id]; 2954 return IC_utilities[id];
2954 } 2955 }
2955 2956
2956 2957
2957 } } // namespace v8::internal 2958 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698